查看文章 |
crontab用法(转)
2008-11-25 14:41
c r o n t a b文件每个条目中各个域的意义和格式: 第1列分钟1~5 9 第2列小时1~2 3(0表示子夜) 第3列日1~3 1 第4列月1~1 2 第5列星期0~6(0表示星期天) 第6列要运行的命令 下面是c r o n t a b的格式: 分<>时<>日<>月<>星期<>要运行的命令 其中<>表示空格 这里有c r o n t a b文件条目的一些例子: 30 21 * * * /apps/bin/cleanup.sh 上面的例子表示每晚的21:3 0运行/a p p s/b i n目录下的cleanup.sh。 45 4 1,10,22 * * /apps/bin/backup.sh 上面的例子表示每月1、1 0、2 2日的4 : 4 5运行/ a p p s / b i n目录下的b a c k u p . s h。 10 1 * * 6,0 /bin/find -name "core" -exec rm {} \; 上面的例子表示每周六、周日的1 : 1 0运行一个f i n d命令。 0,30 18-23 * * * /apps/bin/dbcheck.sh 上面的例子表示在每天1 8 : 0 0至2 3 : 0 0之间每隔3 0分钟运行/ a p p s / b i n目录下的d b c h e c k . s h。 0 23 * * 6 /apps/bin/qtrend.sh 上面的例子表示每星期六的11 : 0 0 p m运行/ a p p s / b i n目录下的q t r e n d . s h。 note that, after you finish your configure, saying, put the job on the file named "mycron", commit it using the command 'crontab mycron' to make it work. |
最近读者: