It’s designed to allow packages to install crontab snippets without having to modify /etc/crontab. Support for /etc/cron.d (drop-in dir for package crontabs) The Debian-specific section hints at the reason system administrators shouldn’t use /etc/cron.d: In general, the system administrator should not use /etc/cron.d/, but use the standard system crontab /etc/crontab. Like /etc/crontab, the files in the /etc/cron.d directory are monitored for changes. This change is specific to Debian see the note under DEBIAN SPECIFIC below. However, they are independent of /etc/crontab: they do not, for example, inherit environment variable settings from it. cron treats the files in /etc/cron.d as in the same way as the /etc/crontab file (they follow the special format of that file, i.e. crontab is used to create the crontab file (the list) and later used to change the previously created crontab file. Comparing the below chart you will note that W, L, and symbols are not supported as they are not standard Linux or SystemV crontab format. crontab is a UNIX command that creates a table or list of commands, each of which is to be executed by the operating system at a specified time. Quoting the cron manpage:Īdditionally, in Debian, cron reads the files in the /etc/cron.d directory. Description Crontab module for reading and writing crontab files and accessing the system cron automatically and simply using a direct API. In Debian derivatives, including Lubuntu, the files in /etc/cron.d are effectively /etc/crontab snippets, with the same format. These files also have username fields,ġ7 * * * * root cd / & run-parts -report /etc/cron.hourlyĢ5 6 * * * root test -x /usr/sbin/anacron || ( cd / & run-parts -report /etc/cron.daily )Ĥ7 6 * * 7 root test -x /usr/sbin/anacron || ( cd / & run-parts -report /etc/cron.weekly )ĥ2 6 1 * * root test -x /usr/sbin/anacron || ( cd / & run-parts -report /etc/cron.monthly )Ĭould you explain how the files under /etc/cron.d are used? Thanks. # command to install the new version when you edit this file # Unlike any other crontab you don't have to run the `crontab' My /etc/crontab file never refers to files under/etc/cron.d, contrary to what the link says: $ cat /etc/crontab PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binģ0 7 * * * root & if then /usr/sbin/invoke-rc.d anacron start >/dev/null fi # /etc/cron.d/anacron: crontab entries for the anacron package On Lubuntu 18.04, the files under /etc/cron.d seem to be crontab files not shell scripts (which was mentioned in the above link): $ cat /etc/cron.d/anacron etc/cron.d/ Put all scripts here and call them from /etc/crontab Scripts or programs in a directory via /etc/crontab file: Or superuser you can use following directories to configure cron jobs. Such as sa-update or sysstat places their cronjob here. Cron reads the files in /etc/cron.d/ directory.
0 Comments
Leave a Reply. |