用户登录
用户注册

分享至

linux同步时间的脚本---定时任务

  • 作者: 齐钰
  • 来源: 51数据库
  • 2020-08-25
进入定时任务编辑页面

crontab -e


编写每十分钟同步一次的脚本

*/10 * * * * /usr/sbin/ntpdate node01


保持与第一台机器时间上的同步,前提是要配好ssh免密登录
所以可能会缺少两个插件

yum -y install openssh-clients* //识别ssh-copy-id
yum install -y ntpdate //时间插件


查看定时任务内容

crontab -l


删除当前所有定时任务

crontab  -r


定时任务的开启|状态|关闭

service crond restart|status|stop
ps -ax |grep cron //状态

设置开机启动定时任务

chkconfig --add crond




软件
前端设计
程序设计
Java相关