Beamtic's logo

Share via:

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.

89 views

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:

  1. /etc/cron.monthly
  2. /etc/cron.weekly
  3. /etc/cron.daily
  4. /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

Comments

  1. How to search a directory and subdirectories for a given string of text in Linux with the grep command.
  2. About the problem with using sudo with graphical programs in Linux.
  3. This simple tutorial shows how to solve the problem with duplicated icons created by custom .desktop files.
  4. My experience with do-release-upgrade is that it rarely breaks anything, so I would say it is generally a safe and reliable way to upgrade Ubuntu.

More in: Linux Tutorials