Cron Scripts Needs to be Executable
Cron scripts that are located inside the cron scheduling folders needs to adhere to these rules in order to be executed.
By. Jacob
Edited: 2020-09-04 11:04
In general, scripts that are supposed to be executed will also need to be marked as executable, this also goes for scripts that are evoked by cron. In addition to this, specific requirements apply for scripts located in the Debian specific scheduling folders.
In order for cron scripts located inside of the cron scheduling folders to be executed by run-parts, they will need to be owned by root, and can also not be writable by group or other. The file names of these scripts also may not contain a dot (.) character.
The restrictions apply for scripts located in the Debian and Ubuntu- specific folders:
- /etc/cron.monthly
- /etc/cron.weekly
- /etc/cron.daily
- /etc/cron.hourly
Note. This may apply to most or all Debian based distributions.
To make a script that is supposed to be run by cron executable:
sudo chmod +x /path/to/script-file.sh
Remember, files that are placed in these folders can not contain a dot character in their names. The only characters allowed are alphanumeric, hyphens and underscores: [a-zA-Z0-9_-].
If even finer control is needed, be sure to read: How to Setup Cron Jobs in Linux
Tell us what you think: