Linux 下执行定时任务 crontab 命令详解
[root@root test]# pwd
/home/admin/test
[root@root test]# crontab -l
00 02 * * * sh /home/admin/optbash/dailyBackup.sh
00 02 * * * sh /home/admin/optbash/deleteDebugSql.sh[root@root test]# touch test.sh
[root@root test]# vim test.sh
/bin/echo `date` > /home/admin/test/console.txt
[root@root test]# ll
total 8
-rw-r--r-- 1 root root 29 Mar 27 21:31 console.txt
-rwxr-xr-x 1 root root 48 Mar 27 21:28 test.sh
[root@root test]# chmod +x ./test.sh[root@root test]# crontab -e
00 02 * * * sh /home/admin/optbash/dailyBackup.sh
00 02 * * * sh /home/admin/optbash/deleteDebugSql.sh
* * * * * sh /home/admin/test/test.sh看看crontab 的时间表达式
其他命令介绍
crond 安装与配置服务
Last updated