美文网首页
linux 定时任务

linux 定时任务

作者: 灰斗儿 | 来源:发表于2020-06-17 09:24 被阅读0次

检查CRONTAB工具是否已经在主机上安装

crontab -l 

检查CRONTAB服务是否已经启动

service crond status 

这个命令还可以检查其他服务,例如 service httpd status 检测apache是否在运行

安装

yum install vixie-cron
yum install crontabs

vixie-cron软件包是cron的主程序;
crontabs软件包是用来安装、卸装、或列举用来驱动 cron 守护进程的表格的程序。

服务启动关闭

service crond start --启动服务
service crond stop --关闭服务
service crond restart --重启服务
service crond reload --重新载入配置
systemctl restart crond.service

systemctl 和service 哪个可用用哪个

添加任务

编辑crontab定时任务文件:vi /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
30 08 * * * /root/crond/check.sh  #设定每天8:30执行一个check 脚本

重启服务后生效

开机自启动

chkconfig –level 35 crond on

相关文章

  • day 17

    第13章 Linux系统定时任务Cron(d)服务应用实践 1.1、Linux定时任务 1.1.1、什么是定时任务...

  • linux crontab: 定时任务

    参考 crontab 定时任务 Linux之crontab定时任务

  • linux Crontab

    Linux Crontab:Linux中用于执行定时任务的工具crontab -e:编辑定时任务crontab -...

  • 定时任务

    Linux定时任务 什么是定时任务: 周期性的执行任务计划的软件,linux里定时任务常用软件有:Crond 使用...

  • day17

    Linux系统定时任务 3W1H 框架 Linux系统定时任务: 1、什么是定时任务? 周期性的执行任务计划的软件...

  • day17-Linux系统定时任务

    Linux系统定时任务 1.什么是定时任务? 周期性的执行任务计划的软件,Linux定时任务软件的常用软件cron...

  • 作业-第04周--课堂-Day17-linux系统定时任务Cro

    Day17 课堂笔记 1 Linux系统定时任务 1、什么是定时任务?周期性的执行任务计划的软件,Linux定时任...

  • Linux笔记

    Linux定时任务 Mysql备份 Linux+Mysql定时备份 * * * * * user task分 时 ...

  • 79.linux定时任务

    Linux定时任务 通过制定 ```crontab -e``编辑和开启定时任务

  • Linux定时任务

    Linux定时任务 centOS: 使用crontab -e //编辑 crontab -l //查看定时任务 生...

网友评论

      本文标题:linux 定时任务

      本文链接:https://www.haomeiwen.com/subject/vpjjxktx.html