【命令名称】 crontab
【使用权限】所有人
【命令语法】 usermod   [-u username] [-l -e -r]
【功能说明】配置例行性的命令,周期性定时工作。
【常用参数】
             u 只有root才能操作,帮助其它用户设置定时工作
             l 例出当前用户的定时任务
             e 新建一个定时任务
             r 删除所有定时任务,如果想移除一个,请用e参数
【使用实例】
1. 创建一个定时任务,每隔10分钟就去同步时间
[cxc@cxcserver ~]$ crontab -e
*/10 * * * * /usr/sbin/ntpdate   time.windows.com   1>/dev/null 2>&1
[cxc@cxcserver ~]$
 
2. 列出当前的定时任务
[cxc@cxcserver ~]$ crontab -l
*/10 * * * * /usr/sbin/ntpdate   time.windows.com   1>/dev/null 2>&1
[cxc@cxcserver ~]$
 
 3.删除所有的定时任务
[cxc@cxcserver ~]$ crontab -r
[cxc@cxcserver ~]$ crontab -l
no crontab for cxc
[cxc@cxcserver ~]$
 
 
【命令名称】 at 
【使用权限】 所有人
【命令语法】 at [mldv] time
             at -c 工作序号
【功能说明】 定制在某个时间进行工作
【常用参数】
             m 当at工作完成后,无论如何也都会给使用者发邮件
             l 列出当前的所有工作,相当于atq
             d 删除当前的某项工作,根目于atrm
             v 详细列出所有at工作列表
        time:时间格式
        HH:MM                ex>08:00  
        如果超过今天的时间,那么就以明天的时间
        HH:MM YYYY-MM-DD     ex>08:00 2012-12-21 
        定时到具体的某年某月某日执行
        HH:MM[am]pm] [MONTH] [DATE]   ex>08am july 2
        也是定时到具体的某年某月某日
        HH:MM[am|pm] + number [minutes|hours|days|weeks]
        在某个时间点后再加一些时间才进行
       
【命令实例】
1. 使用at设置定时任务两个
[cxc@cxcserver ~]$ sudo at now + 1 hour
[sudo] password for cxc:
at> /sbin/shutdown -r now
at> <EOT>
job 2 at 2013-01-14 23:20
[cxc@cxcserver ~]$ sudo at 00:21 2013-01-15
at> reboot
at> <EOT>
job 3 at 2013-01-15 00:21
[cxc@cxcserver ~]$
 
2. 查看当前的at列表
[cxc@cxcserver ~]$ sudo at -l
2       2013-01-14 23:20 a root
3       2013-01-15 00:21 a root
[cxc@cxcserver ~]$ sudo atq
2       2013-01-14 23:20 a root
3       2013-01-15 00:21 a root
[cxc@cxcserver ~]$
 
3. 删除其中一个at列表
[cxc@cxcserver ~]$ sudo at -d 3
[cxc@cxcserver ~]$ sudo at -l
2       2013-01-14 23:20 a root
[cxc@cxcserver ~]$