
226 Important Linux features
DONE
INDEX
INDEX
13.4.3 cron - crontab
Any Linux command or program can be executed automatically on a regular basis.
check if crond is running: ps -efw| grep crond
if crond is not running: service crond start
create a crontab file using the following syntax:
min hour daymo month daywk command
min: minute (0-59)
hour: hour (0-23)
daymo: day of the month (1-31)
month: month of the year (1-12)
daywk: day of the week (0-6 with 0=Sunday)
command: the command or program to be executed
Suppose you want to:
• backup your data at 4.30 am on Tuesday to Friday
• delete all core files at 2 am on Sunday
Note that the second task needs root permissions.
a) type cd to go to your home directory
b) type su to become root
c) edit the file fila and enter the following lines:
30 04 * * 2-5 tar cv /u/data/<user>/nmr
00 02 * * 0 find / -name core -exec rm {} \;
d) type crontab fila
You can skip step b) if all tasks in your crontab file can be done as normal user.
Type man crontab for more information.
Comentários a estes Manuais