1、设置调度,要求在当前时间2分钟后关机,并向登陆系统的所有用户发送提醒信息“The server will shut down in two minutes”
yum install -y at
service atd restart
chkconfig atd on
at now
wall The server will shut down in two minutes
shutdown -h 2
ctrl+d
2、设置调度,在当天的21:00将/var/log压缩打包,然后关机。
at 21:00
tar -zcvf /var/log/log.tar.gz /var/log
shutdown -h now
ctrl+d
3、普通用户(姓名缩写),每周日晚上23:55时将“/etc/passwd”文件的内容复制到宿主目录中,保存为pwd.txt文件。
useradd zhr
echo " 55 23 * * 7 zhr /usr/bin/cp /etc/passwd ~/pwd.txt" >> /etc/crontab
cat /etc/crontab