crontab、chkconfig、systemd、unit、targ
10.23 linux任务计划cron # cat /etc/crontab liunx下的任务计划配置文件 crontab -u、-e、-l、-r 格式:分 时 日 月 周 user command 分范围0-59,时范围0-23,日范文:1-31,月范围:1-12,星期分为:0-6(sunday=0 or 7) # crontab -e 进入到任务计划编辑界面 0 3 * * * /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每个星期,每个月的每天的3点执行命令 0 3 1-10 */2 2,5 /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每周二周五,双数月份的前10天的3点,执行任务 # sytemctl start crond 启动服务 # systemctl stop crond //关闭服务 # ps aux | grep cron 查看是否有此进程 # systemctl status crond 查看状态,Actice绿色启动该 计划在/var/spool/cron/root(最后是以用户名命名的文件) # cront -l //列出信息 # cront -e //编辑 # cront -r /