A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
When writing a CRON job script that you want to install under /etc/cron.*/job-name you must remember to apply the following steps:
1. Write the script and test it as root
2. Make sure to give it execution permission, usually 755
3. The ownership is expected to be root:root
4. The filename cannot include a period or the file it completely ignored
5. The script MUST start with #!/bin/sh or an equivalent (i.e. #!/bin/bash works too.)
6. Use full paths for most everything1
If the job doesn't happen, it's probably because the file does not have execution permissions. In most modern Linux the script filename will appear in a different color if the execution flags are set or not set.
A filename that includes a period (i.e. my.job) is totally ignored, that means you do not get any errors when it fails running.
Other errors will generally appear in your root user email.
run-parts: failed to exec /etc/cron.daily/my-job: Exec format error
This error occurs when the script doesn't start with an interpreter (i.e. #!/bin/sh)
Recent Posts on The Linux Page: