cron and symlinks

I use git for some of the server scripts for better maintenace. Since they're needed all over the system I symlink them into the appropriate places. The other day I symlinked a backup script into the debian-specific cron dir /etc/cron.daily. Unfortunately, this day no backups were created anymore. Cron silently refused to run this script.

A quick look at the man page revealed my mistake(s):

As described above, the files under these directories have to be pass some sanity checks including the following: be executable, be owned by root, not be writable by group or other and, if symlinks, point to files owned by root. Additionally, the file names must conform to the filename requirements of run-parts: they must be entirely made up of letters, digits and can only contain the special signs underscores ('_') and hyphens ('-'). Any file that does not conform to these requirements will not be executed by run-parts. For example, any file containing dots will be ignored. This is done to prevent cron from running any of the files that are left by the Debian package management system when handling files in etc/cron.d as configuration files (i.e. files ending in .dpkg-dist, .dpkg-orig, and .dpkg-new).

Actually, there were a few mistakes: 1) The script was not owned by root (obviously, this is not a good idea since non roots can edit cron-scripts which are run by root!) and 2) the file contained a dot.

After moving the git repo under root, the backups started to show up again.

Date: [2013-04-07 So]

Created: 2015-12-08 Di 23:21

Validate