2

After carefully reviewing the general "cron" answer, I am still stuck.
My crontab reads:

# m h  dom mon dow   command
*/5 * * * * /usr/bin/pkill -f process.py && /usr/bin/python /path/to/process.py > /path/to/process.log 2>&1

I want process.py to be restarted every 5 minutes.
The pkill parts works as expected and process.py is killed every 5 minutes.
However, the second part of my cron task (restarting process.py) does not happen!
- The log file /path/to/process.log does not contain any error, in fact it is not changed.
- running the command outside cron works.
- looking at /var/log/syslog only shows cron executing the command, but no output/errors seem to be logged anywhere
- I tried both ; and && between the two commands. No good.

Any suggestions are welcome!

Shai
  • 121

1 Answers1

1

Is it possible the pkill is killing the cron process to trigger the new instance of process.py because the regex finds both the running process.py and the cron process which is about to start it?

EightBitTony
  • 9,441
  • 1
  • 37
  • 47