NAME
crontab - maintain crontab files for individual users (Vixie Cron)
SYNOPSIS
crontab [ -u user ] file
crontab [ -u user ] [ -i ] { -e | -l | -r }
min hour day month week command
dawang@dawang-Parallels-Virtual-Platform:~$ cat /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 ) #
dawang@dawang-Parallels-Virtual-Platform:~$ ll /etc | grep cron -rw-r--r-- 1 root root 401 12月 29 2014 anacrontab drwxr-xr-x 2 root root 4096 4月 21 06:14 cron.d/ drwxr-xr-x 2 root root 4096 4月 21 06:14 cron.daily/ drwxr-xr-x 2 root root 4096 4月 21 06:08 cron.hourly/ drwxr-xr-x 2 root root 4096 4月 21 06:14 cron.monthly/ -rw-r--r-- 1 root root 722 4月 6 05:59 crontab drwxr-xr-x 2 root root 4096 4月 21 06:14 cron.weekly/
# 启动服务 /sbin/service crond start # 关闭服务 /sbin/service crond stop # 重启服务 /sbin/service crond restart # 重新载入配置 /sbin/service crond reload
dawang@dawang-Parallels-Virtual-Platform:~$ crontab -e no crontab for dawang - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano <---- easiest 3. /usr/bin/vim.tiny Choose 1-3 [2]:
# Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command * * * * * date >> /home/dawang/date.txt * * * * * echo "time to go!" >> /home/dawang/time.txt
dawang@dawang-Parallels-Virtual-Platform:~$ ll | grep txt -rw-rw-r-- 1 dawang dawang 1849 7月 26 16:08 date.txt -rw-rw-r-- 1 dawang dawang 516 7月 26 16:08 time.txt dawang@dawang-Parallels-Virtual-Platform:~$ tail -n 10 date.txt 2016年 07月 26日 星期二 16:01:01 CST 2016年 07月 26日 星期二 16:02:01 CST 2016年 07月 26日 星期二 16:03:01 CST 2016年 07月 26日 星期二 16:04:01 CST 2016年 07月 26日 星期二 16:05:01 CST 2016年 07月 26日 星期二 16:06:01 CST 2016年 07月 26日 星期二 16:07:01 CST 2016年 07月 26日 星期二 16:08:01 CST 2016年 07月 26日 星期二 16:09:01 CST 2016年 07月 26日 星期二 16:10:01 CST dawang@dawang-Parallels-Virtual-Platform:~$ tail -n 10 time.txt time to go! time to go! time to go! time to go! time to go! time to go! time to go! time to go! time to go! time to go!
command > file 把标准输出重定向到文件 command >> file 把标准输出追加到文件 command 1 > file 把标准输出重定向到文件 command 2 > file 把标准错误重定向到文件 command 2 >> file 把标准输出追加到文件 command 2>&1 把command命令标准错误重定向到标准输出 command > file 2>&1 把标准输出和标准错误一起重定向到文件 command >> file 2>&1 把标准输出和标准错误一起追加到文件 command < file 把command命令以file文件作为标准输入 command < file >file2 把command命令以file文件作为标准输入,以file2文件作为标准输出 command <&- 关闭标准输入
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有