Kill process by pid file

I believe you are experiencing this because your default shell is dash (the debian almquist shell), but you are using bash syntax. You can specify bash in the shebang line with something like,

#!/usr/bin/env bash

Or, you could use the dash and bash compatible back-tick expression suggested by admdrew in the comments

kill -9 `cat /var/run/myProcess.pid`

Regardless, you can’t rely on /bin/sh to be bash.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)