crontab定时的使用

//查看所有定时
crontab -l
修改
$ crontab -e //增加定时 //关闭定时 //删除定时
$ crontab -r

/sbin/service crond start //启动服务

/sbin/service crond stop //关闭服务

/sbin/service crond restart //重启服务

/sbin/service crond reload //重新载入配置

/sbin/service crond status //启动服务

//开机启动
chkconfig --level 35 crond on //定时规则

  *           *        *        *        *           command


minute   hour    day   month   week      command


分          时         天      月        星期       命令

//例子

创建

/home/abc.txt

/home/test.sh

在test.sh写入脚本

#! bin/bash

echo "yes" >> /home/abc.txt

给test.sh 执行权限,abc.txt读写权限

查看所有定时

crontab -e 修改定时

修改后 wq保存退出

tail -f /home/abc.txt监听本文变化

 定时访问网页脚本
curl http://www.baidu.com

ubuntu 定时参考

原文地址:https://www.cnblogs.com/huay/p/10796197.html