青春纸盒子

文: 芦苇

你喜欢我笑的样子

我靠上了落寞的窗子

晚风吹起了我的袖子

明月沾湿了你的眸子


转身,你走出了两个人的圈子

树影婆娑,整座院子


挽起袖子

回头,把揽你忧伤一地的影子

装进,青春,这纸盒子


更多代码请关注我的微信小程序: "ecoder"

luwei0915

导航

01_cron计划任务

• 用途:按照设置的时间间隔为用户反复执行某一项固
定的系统任务
• 软件包:cronie、crontabs
• 系统服务:crond
• 日志文件:/var/log/crond
 
• 使用 crontab 命令
– 编辑:crontab -e [-u 用户名]
– 查看:crontab -l [-u 用户名]
– 清除:crontab -r [-u 用户名]

服务状态:
test ~]# systemctl status crond

打包脚本:
test ~]# cat backup.sh
#!/bin/bash
file=/root/test
tar_file=/root/`date +%Y-%m-%d`.test.tar.gz
tar -zPcf $tar_file $file
# 解压缩时:tar -Pxzvf tar_file P要加上

添加执行权限:
test ~]# chmod +x backup.sh

任务要求:root用户凌晨2点执行备份脚本
1.创建任务
]# crontab -e -u root
0 2 * * * /root/backup.sh
2.查看任务
]# crontab -l -u root
3.查看任务文件
]# cat /var/spool/cron/root
4.查看日志文件
]# cat /var/log/cron
5.清除计划任务
]# crontab -r -u root

posted on 2020-01-01 09:21  芦苇の  阅读(189)  评论(0)    收藏  举报