Crontab in OpenSuse 10.2

Crontab in my opinion is a job scheduler, with crontab you can make some program at a specified time that you define. Now lets just started with the configuration. To know if the user that you’re using is allowed to make a crontab you must check if your user is in /etc/crontab.deny then you cannot make a crontab job.

There are several option in crontab command

crontab -e #this will enable you to make or edit your crontab job

crontab -l #this will show you the current crontab job

crontab -r #this will remove your crontab jobs

When you’re editing crontab, here is some of the syntax that will be used

* * * * * 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)

Lets see some of the example:

  • 30 4 * * 0 cp /home /backup

this means that every Sunday at 4.30 am, it will copy folder /home into /backup

  • 0 1 7 7 * /sbin/reboot

this means that in july 7th at 1.00 am, the computer will be rebooted

More in crontab you can make it to execute a file that contain several commands, like this one:

  • 15 4 * * 7 /home/admin/test.sh

inside /home/admin/test.sh

cd /home

find -name “*.mp3*” -print -exec /bin/rm -f ‘{}’ +

quotaoff -avug

quotacheck -avugm

quotaon -avug

repquota -a

this file will do; go to the home directory, find all the file that contain .mp3, print them, delete them, turn off the quota, check the quota, turn it on again, and give the summary of quota.

Advertisements

3 thoughts on “Crontab in OpenSuse 10.2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s