一 在 crontab中的date命令
概述
在crontab 中使用 date命令行 正确做法:
crontab -e
* * * * * touch file_`date +\%Y-\%m-\%d_-\%H:\%M:\%S`.sql
上述含义
编辑crontab 定时任务:每分钟在用户端根目录下创建一个如下格式的文件
file_2012-11-08_-12:16:01
要点
%在crontab中被认为是newline,要用\来转义才行。比如crontab执行行中,如果有‘date +%Y%m%d‘,必须替换为:‘date +\%Y\%m\%d‘
二 在 crontab中执行shell文件
概述
在crontab 中执行shell脚本文件 需要添加sh命令
例如
crontab -e
* * * * * sh
/var/lib/mysql/doc/backupcici.sh
三 查看crontab 详细信息解释
[root@localhost etc]# vi /etc/crontab
# For details see man 4 crontabs
# 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
分享到:
相关推荐
centos7 crontab 安装包
linux C7 crontab离线安装包
crontab使用方法crontab使用方法crontab使用方法crontab使用方法crontab使用方法
redhatlinux6 Crontab安装方法,与二个软件包
Crontab命令
crontab命令格式与例子,crontab file
不依赖于操作系统;使用纯PHP实现的crontab;...$crontab = new crontab ( $files, $flag ,$cachedir); 需要确保$cachedir具有写的权限; 启动和停止 crontab.php?flag=start crontab.php?flag=stop
crontab格式详解
1. 语法介绍 2. 使用方法: 3. 创建crontab? 4. 列出crontab文件 5. 编辑crontab文件 6. 删除crontab文件 7. 恢复丢失的crontab文件 8. crontab中的输出配置
crontab自动备份 利用crontab
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....
centos6.9默认yum无法下载crontab, 整理成功安装后的离线安装软件包上传供大家使用
linux 定时任务 crontab 详细解释 cron服务提供crontab命令来设定cron服务
linux Crontab 用法的详细介绍,
crontab [-e [UserName]|-l [UserName]|-r [UserName]|-v [UserName]|File ] 说明: crontab 是用来让使用者在固定时间或固定间隔执行程序之用,换句话说,也就是类似使用者的时程表。-u user 是指设定指定 user 的时...
crontab 格式解析部分的cpp源码
crontab格式详解
crontab命令详解,详细讲解了crontab如何使用。
关于linux命令crontab的用法,自己总结的 包含简单的用法
linux下crontab详解,crontab组成结构,linux下定时备份数据库shell