Code University

      "Where tuition is free!"

News | Images | Contact     
  • Home
  • Coding KC
  • Scripts
  • Software
  • Templates
  • Tutorials
  • About
 

Coding Knowledge Center

Cron


Page Contents
[X] CLOSE

Anacron

  • Anacron (Config file)
  • Anacron (Examples)
  • Anacron (Format)

At

  • At (Command)
  • At (Prompt)

Cron

  • Cron (Edit cronjob entries)
  • Cron (Example 1)
  • Cron (Example 2)
  • Cron (Example 3)
  • Cron (Example 4)
  • Cron (Format)
  • Cron (List cronjob entries)
  • Cron (Remove cronjob entries)
  • Cron (Setup)
Toggle Page Contents
Anacron (Config file)Copy  To New Window  Top ^
/etc/anacrontab
Configuration file location for anacron.



Anacron (Examples)Copy  To New Window  Top ^
SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin #format: period delay job-identifier command 1 5 cron.daily run-parts /etc/cron.daily 7 10 cron.weekly run-parts /etc/cron.weekly 30 15 cron.monthly run-parts /etc/cron.monthly
This is pretty much the default anacron setup. You can populate shell variables as needed in this anacrontab configuration file. The first command is run once per day after a 5 minute delay upon anacron start up. The next command runs once per week after a 10 minute delay upon anacron start up. The final command runs once per month after a 15 minute delay upon anacron start up. run-parts is the command to run and what follows is a directory parameter the program will use.



Anacron (Format)Copy  To New Window  Top ^
period delay indentifier command
field 1: how frequent in days to run [days] field 2: delay between start of anacron to program execution [minutes] field 3: string which identifies the command field 4: command to execute



At (Command)Copy  To New Window  Top ^
at -f [file w/ commands] [time]
Time Specifications HH:MM (military time) HH:MM AM/PM (12 hour clock) noon, midnight, teatime (4pm) HH:MM MMDDYY HH:MM MM/DD/YY HH:MM DD.MM.YY HH:MM month-name day HH:MM month-name day year now + 2



At (Prompt)Copy  To New Window  Top ^
bash$ at [time] at> [command] at> [command] at> [command] at> ...etc ... at> CTRL-D (to end)
Typing the at command with a specified time puts the user on the "at" command prompt. From here the user enters commands that they wish to run at that specified time. When done entering commands, hit CTRL-D to exit.



Cron (Edit cronjob entries)Copy  To New Window  Top ^
crontab -e
Edit current list of cron job entries.



Cron (Example 1)Copy  To New Window  Top ^
SHELL=/bin/bash MAILTO=steved HOME=/home/steved * 12 10-16/2 * * my_command * 12 10,12,14,16 * * my_command
Again you can specify shell variables such as SHELL, MAILTO and HOME in the crontab configuration file. Run my_command at noon every 2 days from the 10th thru the 16th (10th, 12th, 14th, 16th)



Cron (Example 2)Copy  To New Window  Top ^
*/15 9-17 * * * my_command
Run my_command every 15 minutes between 9am and 5pm everyday



Cron (Example 3)Copy  To New Window  Top ^
00 00 15 10-12 * my_command
Run my_command on the 15th day of October, November and December at midnight



Cron (Example 4)Copy  To New Window  Top ^
00 06 * * 0 my_command
Run my_command every Sunday at 6am



Cron (Format)Copy  To New Window  Top ^
* * * * * command
field *: non-specified field field 1: minute [0-59] field 2: hour [0 (Midnight) - 23 (11pm)] field 3: day of month [1-31] field 4: month [0 (January) - 11 (December)] field 5: day of the week [0 (Sunday) - 7 (Saturday)] field 6: command to run Delimiters - = specify a range , = seperate multiple values / = specify interval



Cron (List cronjob entries)Copy  To New Window  Top ^
crontab -l
List current crontab job entries.



Cron (Remove cronjob entries)Copy  To New Window  Top ^
crontab -r
BE CAREFULL!!! Removes all of the user's crontab entries!!!



Cron (Setup)Copy  To New Window  Top ^
crontab -u [user] [file]
Specify a crontab user and the cronjob configuration file to use.
Technologies
  • Introduction
  • Awk
  • Bash
  • Cron
  • CSH
  • CSS
  • CVS
  • FTP
  • FTPS
  • HTML
  • JavaScript
  • KSH
  • Linux
  • Linux (Debian)
  • Linux (LPIC 101-102)
  • Linux/Unix
  • Mac OS X
  • MySQL
  • Oracle
  • Perl
  • PGP
  • PHP
  • Sed
  • SQLite
  • SSH/SCP/SFTP
  • Telnet
  • UNIX
  • Windows
Resources
  • CodeIgniter - MVC Framework
  • HowtoForge - Linux Tutorials
  • Linux Today - Linux News
  • Lxer - Linux News Feed
  • Monsterb - Linux, Podcasting
  • MySQL - Databasing
  • Perl - Programming
  • PHP - Programming
  • Systhread - Admin & Programming
  • W3Schools - Web Tutorials
About

Code University contains a wealth of technical information aimed at the computer sciences.


 
Home | Coding KC | Scripts | Software | Templates | Tutorials | About
Top ^
 
© 2007-2012 Code University| Disclaimer
Website template by Arcsin