-
1.atd和crond两个任务管理程序的区别:
atd是一种一次性任务的调度程序,可用于设置一些短期计划任务。而crond是一个周期性任务的调度程序,适用于长期计划任务。
-
2.指定在2023/04/15 09:00将时间写入testmail.txt文件中:
[root@server ~]# at 09:00 2024-04-15 warning: commands will be executed using /bin/sh at> date >> /testmail.txt at> <EOT> job 1 at Mon Apr 15 09:00:00 2024 [root@server ~]# at -l 1 Mon Apr 15 09:00:00 2024 a root
-
3.指定每天凌晨4:00将该时间点之前的日志信息备份到一个目录下(/var/log/messages),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
[root@server ~]# vim /etc/crontab 0 4 * * * root /bin/cp /var/log/messages /test/logfile`date +\%Y-\%m-\%d-\%H:\%M`