Google Plus

Cron Job files on CentOS and Fedora

Written by Mel Kham on . Posted in Linux tutorials

CentOS and Fedora Linux use a set of directories in /etc to control when jobs run.

These directories take the following form:

/etc/cron.hourly – jobs that run once per hour

/etc/cron.daily – jobs that run once per day

/etc/cron.weekly – jobs that run one per week

/etc/cron.monthly – jobs that run once per month

The jobs that you start something like

/sbin/yum  -y  update

or

/sbin/reboot

or running a script some where in your machine

/opt/scripts/script1.sh &

or syncrionize with remote host with Rsync commands

The other way is to add these jobs via Crontab commands :

crontab -e Edit your crontab file, or create one if it doesn’t already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)

and add the line like

* * * * * command to be executed
- – - – -
| | | | |
| | | | +—– day of week (0 – 6) (Sunday=0)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)

example :

00 06 * * * rm /home/pirat9/tmp/*

Thats mean every day at 6 in the morning remove the tmp files in my directory

If you need any other help, please post it on the Forums

{loadposition user9}

Related Articles By Tags:

{loadposition user1}

For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

Lolman

|

in cmd

Oliver

|

Do you think that it works on a Macbook Air 1,1?… ohh and, it must be installed in a different partition than Mac OS X, right?… can´t have i installed only Ubuntu on my hard drive?

Nova

|

I wonder if there is a way to create your own themes.

Red Adaya

|

Thank you! This worked for me!!!

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .