cron and at

#assign crontab job to user
cat>schedule.txt
30 05 * * * /bin/echo "hello"
crontab -u xing schecule.txt
service crond restart

#user cron to back up a directory /home  (/dev/hda3)
vi /var/schedule
30 17 * * * /sbin/dump  -0u /dev/st0 /dev/hha3
crontab /var/schedule
service crond restart

#deny all users except root to access cron
vi /etc/cron.allow
root
vi /etc/cron.deny
write all users name on one single line to deny

#add a job to display :hello on tty08 every 2 mins
cat>schedule.txt
*/2 * * * * /bin/echo "hello">/dev/tty08
crontab schedule.txt
crontab -l
service crond restart

#run a job backup 13pm and 20pm every weekday
crontab -e
0 13,20 * * 1,2,3,4,5 backup

# run ntpdate at min 15 at 15,18,21 every day
crontab -e
15 15,18,21 * * * /usr/sbin/ntpdate 192.168.1.1

#daily cron jobs
1. tmpwatch
deletes /tmp files has not accessed for 10days
deletes /var/tmp files has not been touched for 30days
2. logrotate
/var/log/messages is rotated weekly to /var/log/messages.X , X is the week  in order
configuration file locate /etc/logrote.conf
3. logwatch
 
#anacron system: runs cron jobs that did not run when the computer is down



#list at queue
atq

#check files have not been visited for 1day
tmpwatch -v --test 24 /tmp








你可能感兴趣的:(职场,休闲)