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.
It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .
Use the crontab -e command to open your user account's crontab file. Commands in this file run with your user account's permissions. If you want a command to run with system permissions, use the sudo crontab -e command to open the root account's crontab file.
In a crontab file, blank lines or lines starting with # , spaces or tabs will be ignored.
Every job that's run by cron is run in the background automatically, so no need for the &
See this too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With