1. crond.service

2. configuration

2.0 format

# 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

2.1 per-user

/var/spool/cron/<user_name>

2.2 system-level

/etc/crontab
/etc/cron.d/

2.3 configure to run all script in a folder

First, create a folder and put all script into it

And then, use "run-parts", 
to create a configure item in one of cron configuraiton files, like this:

01 * * * * root run-parts /etc/cron.hourly

3. How to configure a cron job

3.1 directly add conf item into

/var/spool/cron/<user_name>
/etc/crontab

3.2 create a cron conf file and put it into

/etc/cron.d/

3.3 use crontab

crontab: invalid option -- 'h' 
crontab: usage error: unrecognized option 
Usage: 
crontab [options] file 
crontab [options] 
crontab -n [hostname]

Options: 
-u <user> define user 
-e edit user's crontab 
-l list user's crontab 
-r delete user's crontab 
-i prompt before deleting 
-n <host> set host in cluster to run users' crontabs 
-c get host in cluster to run users' crontabs 
-s selinux context 
-x <mask> enable debugging

4. cron log

/var/log/cron

5. anacron

asynchrous cron

5.1 cron trigger anacron:

/etc/cron.hourly/0anacron

5.2 anacron configuraiton

/etc/anacrontab

1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

/etc/cron.d/0hourly ==> anacron ==> /etc/anacrontab/ ==> cron ==> /etc/cron.daily/cron.weekly/cron.monthly

cron on Centos的更多相关文章

  1. 在CentOS 7上使用Tripwire监控和检测修改的文件

    在CentOS 7上使用Tripwire监控和检测修改的文件 Tripwire是一个免费的开源入侵检测系统(IDS). 它是用于监视和警告系统上文件更改的安全工具. Tripwire是一个功能强大的I ...

  2. ansible环境部署及常用模块总结 - 运维笔记

    一.  Ansible 介绍Ansible是一个配置管理系统configuration management system, python 语言是运维人员必须会的语言, ansible 是一个基于py ...

  3. 11.Weblogic-SSRF漏洞复现

    应为这一阵正好在学习SSRF漏洞,又苦于本人太菜没有挖到SSRF,只能复现... 先贴出很早之前央视网SSRF可窥探内网(Weblogic SSRF案例):https://www.secpulse.c ...

  4. SSRF总结

    ssrf漏洞,全称为服务端请求伪造漏洞,由于有的web应用需要实现从其它服务器上获取资源的功能,但是没有对url进行限制,导致可以构造非本意的url对内网或者其它服务器发起恶意请求.ssrf漏洞的危害 ...

  5. SaltStack--配置管理

    saltstack配置管理 Saltstack状态模块 远程执行模块的执行是过程式,而状态是对minion的一种描述和定义,管理人员不需要关系部署任务如何完成的,只需要描述minion的状态描述.它的 ...

  6. 对ansible不支持service模块的status命令进行修正

    原生的ansible不支持service.status,在Google之后,发现有人提交了一个patch,可以支持status选项.见https://github.com/ritzk/ansible- ...

  7. centos和ubuntu下使用cron设置定时任务

    1.启动cron工具[ps:使用root权限] centos启动cron两种方式 a) /etc/init.d/crond start b) service crond start ubuntu启动c ...

  8. 在CentOS 6 的cron/crontab中使用wine运行exe程序

    几个月前服务器的OS从Ubuntu 10.04转为CentOS 6.3,装好wine后手动运行shell脚本可以正常运行指定的exe程序(脚本和Ubuntu中的一样),于是就直接修改crontab定时 ...

  9. linux/centos定时任务cron

    https://www.cnblogs.com/p0st/p/9482167.html cron: crond进程 crontab修改命令 * * * * *  command parameter & ...

随机推荐

  1. BindException 无法指定被请求的地址

    Caused by: java.net.BindException: Problem binding to [hadoop3:8096] java.net.BindException: 无法指定被请求 ...

  2. shutdown的几种方式,shutdown abort的一些弊端有哪些

    1.shutdown normal     正常方式关闭数据库. 2.shutdown immediate     立即方式关闭数据库.     在SVRMGRL中执行shutdown immedia ...

  3. C++不能在栈上申请动态内存,而只能依靠指针

    以下三种情况皆错,都编译不过: int main(int argc, char* argv[]) { int a; int b[a]; } int main(int argc, char* argv[ ...

  4. qrcode.react和jquery.qrcode生成二维码

    qrcode.react 1.安装 npm install qrcode.react 2.用法(这里用的ant design) import React from 'react'; import QR ...

  5. XMU 1614 刘备闯三国之三顾茅庐(二) 【逆向思维+二维并查集】

    1614: 刘备闯三国之三顾茅庐(二) Time Limit: 1000 MS  Memory Limit: 128 MBSubmit: 15  Solved: 5[Submit][Status][W ...

  6. java泛型-类型擦除

    详细内容:参考java编程思想P373,p650. Java 泛型(Generic)的引入加强了参数类型的安全性,减少了类型的转换,但有一点需要注意:Java 的泛型在编译器有效,在运行期被删除,也就 ...

  7. UITabBarController简单介绍

    一.简单介绍 UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例 ...

  8. 并不对劲的cdq分治解三维偏序

    为了反驳隔壁很对劲的太刀流,并不对劲的片手流决定与之针锋相对,先一步发表cdq分治解三维偏序. 很对劲的太刀流在这里->  参照一.二维偏序的方法,会发现一位偏序就是直接排序,可以看成通过排序使 ...

  9. [Tjoi2016&Heoi2016] 树

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4551 [算法] 树链剖分 时间复杂度 : O(QlogN) [代码] #includ ...

  10. 提高你的Python: 解释‘yield’和‘Generators(生成器)’

    在开始课程之前,我要求学生们填写一份调查表,这个调查表反映了它们对Python中一些概念的理解情况.一些话题("if/else控制流" 或者 "定义和使用函数" ...