编写定时任务
crontab -e
# 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
每小时的第1分钟执行该脚本
1 * * * * sh /home/hadoop/test.sh
每1分钟执行该脚本
*/1 * * * * sh /home/hadoop/test.sh
每天的1点执行该脚本
0 1 * * * sh /home/hadoop/test.sh
每周日的1点1分执行该脚本
1 1 * * 0 sh /home/hadoop/test.sh
每月第1天的1点1分进行脚本的执行
1 1 1 * * sh /home/hadoop/test.sh
每个周一到周三的早上10点执行该脚本
0 10 * * 1-3 sh /home/hadoop/test.sh
每周的周一、周三、周五的早上10点执行该脚本
0 10 * * 1,3,5 sh /home/hadoop/test.sh
test.sh
#!/bin/sh dateformat=`date +"%Y%m%d%H%M%S"` echo "Hello World" >> /home/hadoop/test/log/test_${dateformat}.log
每天定时清理7天前的日志
10 1 * * * sh /home/hadoop/test/auto_del_7_days_ago_log.sh
相关推荐
crontab离线安装及依赖rpm包 cronie-1.4.4-16.el6_8.2.x86_64.rpm cronie-anacron-1.4.4-16.el6_8.2.x86_64.rpm crontabs-1.10-33.el6.noarch.rpm cyrus-sasl-2.1.23-15.el6_6.2.x86_64.rpm logrotate-3.7.8-28.el6....
linux C7 crontab离线安装包
centos7 crontab 安装包
redhatlinux6 Crontab安装方法,与二个软件包
cron的配置文件称为“crontab”,是“cron table”的简写。 cron是一个linux下 的定时执行工具,可以在无需人工干预的情况下运行作业。 service crond start //启动服务 service crond stop //关闭服务 ...
1.1 /etc/crontab 文件 在/etc目录下有一个crontab文件,这里存放有系统运行的一些调度程序。每个用户可以建立自己的调度crontab。 如: 代码如下:[root@dave ~]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin...
crontab使用方法crontab使用方法crontab使用方法crontab使用方法crontab使用方法
自己总结的简单易解的crontab的使用。 crontab 是用来让使用者在固定时间或固定间隔执行程序之用,换句话说,也就是类似使用者的时程表。-u user 是指设定指定 user 的时程表,这个前提是你必须要有其权限(比如说是 ...
centos6.9默认yum无法下载crontab, 整理成功安装后的离线安装软件包上传供大家使用
crontab命令格式与例子,crontab file
Crontab命令
$crontab_server = new \Jenner\Zebra\Crontab\Crontab($crontab_config); $crontab_server->start(); 工具短小,但很精悍 在分布式场景中,你可以把定时任务写入数据库中进行统一管理,你可以设定哪些...
Linux定时脚本crontab中文乱码.docx
实现思路详见:https://blog.csdn.net/qq_33901011/article/details/100155334 该工程用C语言实现了crontab...里面用到了Linux源码中的Crond.c的ParseField函数来解析crontab表达式,基姆拉尔森计算公式计算星期等。
不依赖于操作系统;使用纯PHP实现的crontab;...$crontab = new crontab ( $files, $flag ,$cachedir); 需要确保$cachedir具有写的权限; 启动和停止 crontab.php?flag=start crontab.php?flag=stop
1. 语法介绍 2. 使用方法: 3. 创建crontab? 4. 列出crontab文件 5. 编辑crontab文件 6. 删除crontab文件 7. 恢复丢失的crontab文件 8. crontab中的输出配置
crontab [-e [UserName]|-l [UserName]|-r [UserName]|-v [UserName]|File ] 说明: crontab 是用来让使用者在固定时间或固定间隔执行程序之用,换句话说,也就是类似使用者的时程表。-u user 是指设定指定 user 的时...
Crontab_1.10.RPM文件(含依赖rpm包): crontabs-1.10-33.el6.noarch.rpm cronie-1.4.4-16.el6_8.2.x86_64.rpm cronie-anacron-1.4.4-16.el6_8.2.x86_64.rpm cronie-noanacron-1.4.4-16.el6_8.2.x86_64.rpm
linux 定时任务 crontab 详细解释 cron服务提供crontab命令来设定cron服务
linux Crontab 用法的详细介绍,