时间:2023-03-16来源:东坡网作者:chunhua
crontab命令主要用于设置周期性被执行的指令,今天小编将给大家详细讲解Linux下的crontab定时执行任务命令,有兴趣的伙伴可以阅读文章了解!
前言:
在Linux中,周期执行的任务一般由cron这个守护进程来处理[ps -ef|grep cron]。cron读取一个或多个配置文件,这些配置文件中包含了命令行及其调用时间。cron的配置文件称为“crontab”,是“cron table”的简写。
Linux下的crontab定时执行任务命令详解:
一、cron服务
cron是一个linux下 的定时执行工具,可以在无需人工干预的情况下运行作业。
service crond start //启动服务
service crond stop //关闭服务
service crond restart //重启服务
service crond reload //重新载入配置
service crond status //查看服务状态
二、cron在3个地方查找配置文件:
1、/var/spool/cron/ 这个目录下存放的是每个用户包括root的crontab任务,每个任务以创建者的名字命名,比如tom建的crontab任务对应的文件就是/var/spool/cron/tom。一般一个用户最多只有一个crontab文件。
三、/etc/crontab 这个文件负责安排由系统管理员制定的维护系统以及其他任务的crontab。
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # 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
2023-03-16
Linux关机命令大全:Linux各关机命令之间的区别和用法2023-03-16
linux常用命令有哪些?Linux常用操作命令大全2023-03-16
如何安装Ubuntu系统?Ubuntu系统的安装教程Linux系统下Nginx 日志可以查看系统运行记录和出错说明,对Nginx 日志的分析可以了解系统运行的状态。那么Linux系统Nginx日志怎么分析呢?...
2023-03-16
Linux每次建立SVN版本库的过程都非常麻烦,如果将这些通过shell脚本来实现的话会简单很多,那么这个shell脚本要如何编译呢?下面小编就给大家介绍下Linux利用shell脚本创建SVN版本库的方法。...
2023-03-16