shlle,每周5凌晨3点备份/var/log下的所有日志文件

#!/bin/bash
tar -zcvf log-`date +%Y%m%d`.tar.gz /var/log
[root@debug ~]# pwd
/root
[root@debug ~]# ll shell1.sh 
-rwxr-xr-x 1 root root 57 Dec 29 18:16 shell1.sh
[root@debug ~]# chmod +x shell1.sh 

[root@debug ~]# crontab -e
00 19 * * * /usr/bin/sh /root/shell1.sh
-rw-r--r--  1 root root 11421349 Dec 29 19:00 log-20181229.tar.gz

你可能感兴趣的:(Linux)