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/

inside /home/admin/

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.

Timed Shutdown in OpenSuse 10.2

This command will be very usefull if you want to make a maintenance from remote site. With this command it will warn current user that still login, if the computer will be shut down or rebooted within some interval time. I think this command only available in OpenSuse CMIIW.

To do that all you need to do is an root rights so that you can execute this command, here are some of the option:

shutdown -r -F 1 This machine will be rebooted

This will make your machine rebooted within 1 minutes and it will show “This machine will be rebooted” message and do fsck after reboot

shutdown -P 1 This machine will be turned off

This will make your machine power off within 1 minutes and show “This machine will be turned off” message

shutdown -k It’s only a warning

This will only a warning message to all connected user