Search code examples
linuxcron

Should linux cron jobs be specified with an "&" to indicate to run in background?


In a crontab file, should commands be specified with a trailing "&", or will the command run in the background anyway?

I have:

*/20 * * * * /home/me/monitor/check.sh /home/me/monitor/check.properties  >> /home/me/monitor/check.log 2>&1 &

I've seen contradictory answers to this question in various places. Some say no need to put an "&", others that without the ampersand cron waits for output from the command, even though all output is redirected.


Solution

  • Every job that's run by systemd-cron (and most other implementations?) is run in the background automatically, so no need for the &.