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!