Ubuntu和Centos的定时脚本

一.环境准备

  1.系统环境

  •   Ubuntu系统版本 : Ubuntu 18.04.4 LTS
  •   Centos系统版本:6.5

二.Ubuntu的定时任务设置

#查看定时任务
crontab -l

#编辑定时任务
crontab -e
#重启定时服务,开启定时任务
service cron restart

三.Centos的定时任务设置

#查看定时任务
crontab -l

#编辑定时任务
crontab -e

#重启定时服务,开启定时任务
service crond restart

四.两个系统关于时间任务的设置方式是一致的

#每天早上六点半执行脚本,并把脚本日志放到/root/bin/task.log
30 6 * * * /bin/bash -x /root/bin/task.sh >>/root/bin/task.log 2>&1

猜你喜欢

转载自www.cnblogs.com/makailong/p/12605674.html