我的crontab文件

# /etc/crontab: system-wide crontab

# Unlike any other crontab you don't have to run the `crontab'

# command to install the new version when you edit this file

# and files in /etc/cron.d. These files also have username fields,

# that none of the other crontabs do.



SHELL=/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin



# m h dom mon dow user    command

17 *    * * *    root    cd / && run-parts --report /etc/cron.hourly

25 6    * * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

47 6    * * 7    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

52 6    1 * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

*  */1    * * *    wupeng    DISPLAY=:0 /home/wupeng/public/notify.sh

*/30 *    * * *    wupeng    DISPLAY=:0 /home/wupeng/public/timer.sh

#

 

其中notify.sh作用主要是为了提醒你从开机到现在已经有多长时间,让你休息一会:

#!/bin/sh

bootime=`awk '{print $1}' /proc/uptime`

text="你已经连续开机超过2小时了,请注意休息。系统将于5分钟后关闭,请及时保存."

if [ ${bootime%.*} -ge 7200 ]

then notify-send $text

fi

 

timer.sh就是整点报时,每各30分钟显示一次:

#!/bin/sh

nowtime=`date +%H:%M:%S`

notify-send "现在时刻${nowtime}"

你可能感兴趣的:(crontab)