Sat Feb 27, 2010 4:57 pm - What Are Cronjobs? Explain Cron Jobs
#3175
What Are Cronjobs? Explain Cron Jobs
the other day, i was wondering what cron jobs were. so if you want to know what a cronjob is a deamon which means it runs continuely, lookfor for events taht cause it to spring into action.
for example, you can use cron jobs to run scripts by the minute, hourly, daily, weekly, monthly, yearly - you get the picture...
unlike most daemons, which are network servers, cron responds to temporal events. specifically, it wakes up once a minute, examines configuration files in the /var/spool/cron and /etc/fron.d directories and the /etc/crontab file and then executes the command contained in these configuration files if the time matches the time listed in the files.
cool!!!
one example you can use cron jobs is to make daily backups of your server on a daily basis
# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
if you want to list all of your current schedules cron jobs send this command:
NOTE: you must be logged is as superuser (root)
for example, you can use cron jobs to run scripts by the minute, hourly, daily, weekly, monthly, yearly - you get the picture...
unlike most daemons, which are network servers, cron responds to temporal events. specifically, it wakes up once a minute, examines configuration files in the /var/spool/cron and /etc/fron.d directories and the /etc/crontab file and then executes the command contained in these configuration files if the time matches the time listed in the files.
cool!!!
one example you can use cron jobs is to make daily backups of your server on a daily basis
# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
if you want to list all of your current schedules cron jobs send this command:
crontab -l
NOTE: you must be logged is as superuser (root)
author: Downther