美文网首页自动化运维
Linux配置定时任务

Linux配置定时任务

作者: 褪色的记忆1994 | 来源:发表于2018-02-05 09:23 被阅读45次
  • 修改/etc/crontab文件
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
 
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
* * * * * root rm -rf /var/log/*

其中最后一行的意思是以root用户每一分钟删除一次log文件

个人博客:https://blog.xvjialing.xyz

github主页:https://github.com/xvjialing

相关文章

  • linux下的定时任务-crontab

    在linux下,有时我们有一些定时任务需要执行,这时我们使用crontab命令来配置定时任务。在linux下用来周...

  • 用crontab在Linux下执行定时任务

    crontab是什么 crontab是Linux的一个配置定时任务的命令,使用它可以灵活地配置一些定时任务。 cr...

  • Linux配置定时任务

    修改/etc/crontab文件 其中最后一行的意思是以root用户每一分钟删除一次log文件 个人博客:http...

  • 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 crontab(定时任务) 配置

    crontab 命令 crontab 语法内容 星号(*)表示取值范围内的所有值。例如,* 在hour的位置,表示...

  • Linux定时任务crontab配置

    添加任务流程 编辑定时任务: 编辑完需要重启cron服务: 任务格式 在以上各个字段中,还可以使用以下特殊字符: ...

  • 定时任务

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

  • Python-crontab和Django-crontab 实现

    Linux中可以使用crontab设置定时任务,可以通过命令crontab -e编写任务,也可以直接写配置文件设置...

网友评论

    本文标题:Linux配置定时任务

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