Cron

From TheBeard Science Project Wiki
Revision as of 17:09, 29 February 2016 by Beard (talk | contribs) (Created page with "<pre> packages: cron daemons: crond configs: /etc/cronbtab - system tasks /etc/cron.d/ - caontains system cron tables /var/spool/cron/ - contains user cron tables. file...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
packages:
	cron

daemons:
	crond

configs:
	/etc/cronbtab - system tasks
	/etc/cron.d/ - caontains system cron tables
	/var/spool/cron/ - contains user cron tables. files are saved by username.
	/etc/cron.allow - users allowed to use cron. if allow/deny files do not exist, only root can use cron. this file has priority over cron.deny.
	/etc/cron.deny - users not allowed to use cron. create this file and leave it blank to allow all user. this id default in Fedora.
	/etc/cron.hourly/ - place shell scripts in here to be run at the given time interval.
	/etc/cron.daily/ - place shell scripts in here to be run at the given time interval.
	/etc/cron.weekly/ - place shell scripts in here to be run at the given time interval.
	/etc/cron.monthly/ - place shell scripts in here to be run at the given time interval.

		
other:
	* = wildcard
	numbers can be comma separated (20,40)
	numbers can be a range (1-5)
	time is in 24-hour format

commands:
	1 2 3 4 5 command
		1 = minute past the hour (0-59)
		2 = hour past midnight (0-23)
		3 = day of month (1-31)
		4 = month of year (1-12)
		5 = day of week (0=sun 1=mon 2=tue 3=wed 4=thu 5=fri 6=sat 7=sun)

	crontab - command that helps manage cron jobs
		-u <user> - specify a user
		-e - edit. opens crontab in editor of choice.
		-l - list current crontab
		-i - remove current crontab with a prompt.
		-r  - remove current crontab. NO PROMPT!
example:
	20,40 17 * * 1-5 /myscript - runs 'myscript' at 5:20pm and 5:40pm each day, mondat through friday
	0 4 1 * * /backup - runs 'backup' at the 1st of the month every month at 4:00am.