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

 

posted @ 2020-03-31 15:46  马小纪  阅读(164)  评论(0编辑  收藏  举报