Linux计划任务[crond]

1. crond计划任务概述

什么是计划任务,计划任务类似于我们平时生活中的闹钟。
Linux系统的计划任务服务crond可以满足周期性执行任务的需求。
crond进程每分钟会处理一次计划任务, 计划任务主要是做一些周期性的任务目前最主要的用途是定时备份数据

Schedule one-time tasks with at.   一次性调度执行 at
Schedule recurring jobs with cron. 循环调度执行 cron
Schedule recurring system jobs. 所有计划任务执行中的输出都会以邮件的方式发送给指定用户, 除非重定向


循环调度执行cron 进程每分钟会处理一次计划任务
[root@wenhs5479 ~]# systemctl status crond.service 
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since 日 2019-03-24 19:26:36 CST; 3min 22s ago
 Main PID: 9443 (crond)
   CGroup: /system.slice/crond.service
           └─9443 /usr/sbin/crond -n

3月 24 19:26:36 wenhs5479 systemd[1]: Started Command Scheduler.
3月 24 19:26:36 wenhs5479 crond[9443]: (CRON) INFO (RANDOM_DEL...
3月 24 19:26:37 wenhs5479 crond[9443]: (CRON) INFO (running wi...
Hint: Some lines were ellipsized, use -l to show in full.

[root@wenhs5479 ~]# ps aux |grep crond
root       9443  0.4  0.0 126284  1716 ?        Ss   19:26   0:01 /usr/sbin/crond -n
root      11960  0.0  0.0 112728   988 pts/0    S+   19:30   0:00 grep --color=auto crond
[root@wenhs5479 ~]#

计划任务分为以下两种情况:

  • 系统级别的定时任务:

清理系统缓存
临时文件清理
系统信息采集
日志文件切割

  • 用户级别的定时任务:

定时同步互联网时间
定时备份系统配置文件
定时备份数据库文件

2. crond配置文件详解

文件              说明
/etc/crontab        //crontab配置文件
/etc/cron.deny      //该文件中所列用
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值