Sample Header Ad - 728x90

What could be happening between pidof and kill to cause "no such process"?

2 votes
1 answer
1046 views
I've inherited quite a bit of code and am looking at a cron job that restarts a service once an hour, no other scripts touch this process and this code is ran. #The name of the process has been scrubbed to protect the guilty procpid=$( pidof proc ) if [ -n "$procpid" ]; then kill -HUP $procpid procpid=$( pidof proc ) if [ -z "$procpid" ]; then error "PROC ain't running, go figure out why" fi fi 99.9999% of the time this works. Problem is, I'm a five 9's kind of guy who hates inexplicable syslog messages being emailed to me and I want to know why: > kill: (1076) - No such process keeps popping up in there. Does this necessarily mean that something else is killing my process between the "if" and the "kill" or could something more insidious be going on? --- Because in all likelihood this code is fine and in fact something else kills the process between the two lines, is there "what killed me" diagnostic sort of checker thing somewhere that I could use to at least debug why I'm getting these warnings?
Asked by Peter Turner (1734 rep)
Apr 23, 2015, 04:15 PM
Last activity: Apr 23, 2015, 04:54 PM