Day-14-Linux中的计划任务cron.pdfVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
本笔记为北京千锋 V2017.1 《02 Linux 云主机系统管理及服务配置实战》,笔 记中所涉及到的项目均基于 Centos7u3 x86_64 或 Centos6u8 环境。笔记内 容不包括扩展及提高部分,主要目的是为了帮助初次接触 Linux 运维技术的同 学能够快速上手。 千锋所有学员均可自由使用和转载该笔记,为 了尊重作者的辛劳,敬请注明出处! cron 计划任务 =========================================================================== 作用: 计划任务主要是做一些周期性的任务,目前最主要的用途是定期备份数据 Schedule one-time tasks with at. 一次性调度执行 at Schedule recurring jobs with cron. 循环调度执行 cron Schedule recurring system jobs. 所有计划任务执行中的输出都会以邮件的方式发送给指定用户, 除非重定向 一次性调度执行 at [ 了解] 语法格式: at TIMESPEC now +5min teatime tomorrow (teatime is 16:00) noon +4 days 5pm august 3 2018 例 1: [root@tianyun ~]# at now +1min at useradd uuuu at EOT job 1 at Sat Mar 21 22:34:00 2015 [root@yang ~]# atq 3 Thu Mar 30 09:55:00 2017 a root [root@tianyun ~]# id uuuu 例2: [root@yang ~]# vim at.jobs useradd u99 useradd u00 touch /`date +%F`.txt [root@yang ~]# at now +1min at.jobs 注: sudo 执行需要考虑tty 问题 循环调度执行 cron [root@tianyun ~]# systemctl status crond.service [root@tianyun ~]# ps aux |grep crond root 550 0.0 0.0 126300 1648 ? Ss 10:05 0:00 /usr/sbin/crond -n crond 进程每分钟会处理一次计划任务 =====================用户级===================== 存储位置: [root@tianyun ~]# ls /var/spool/cron/ 管理方式: crontab -l List the jobs for the current user. crontab -r Remove all jobs for the current users. crontab -e Edit jobs for the current user. 管理员可以使用 -u username, 去管理其他用户的计划任务 /etc/cron.deny : alice jack [alice@yang ~]$ crontab -e You (alice) are not allowed to use this program (crontab) See crontab(1) for more information 语法格式 Job format: Minutes Hours Day-of-Month Month Day-of-Week Command # 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 # | | | | | # * * * * * command 0 2 * * * /mysql_back.sh 0 2 14 * * /mysql_back.sh 0 2 14 2 * /mysql_back.sh 0 2

文档评论(0)

寻找是恶 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档