1.atd和crond两个任务管理程序的区别
atd只执行一次,cround会周性的检查作业,如有要执行的作业就会调去执行
2.指定在每周周一09:00将时间写入testmail.txt文件中
[root@localhost ~]#crontab -e
0 9 * * 1 date >> testmail.txt
3.指定在每天凌晨4:00将该时间点之前的系统日志信息(/var/log/messages )备份到目录下/backup,备份后日志文件名显示格式logfileYY-MM-DD-HH-MM
[root@localhost ~]#crontab -e
0 4 * * * cp /var/log/messages /backup/logfile`date +\%Y-\%m-\%d-\%H:\%:M`
4、配置ntp时间服务器,确保客户端主机能和服务主机同步时间
1安装chrony
[root@localhost ~]#yum install -y chrony
2服务端配置
[root@localhost ~]#vim /etc/chrony.conf
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.220.0/24
[root@localhost ~]#systemctl restart chronyd
[root@server1 ~]# chronyc sources
3客户端配置
[root@localhost ~]#vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 192.168.220.128 iburst
[root@localhost ~]#systemctl restart chronyd
[root@server1 ~]# chronyc sources