pkill probably only checks the actual name of the binary. We were checking a shell script, which I'm guessing is not launched via a shebang, so that name was actually an arg to sh, or something like that. Use pidof instead, which matches the full command line.