#! /bin/bash
##zhaoyingbin##
#export HISTTIMEFORMAT='%F %T '
find /home/zhaoyingbin/ -name "*.tgz" -type f -mtime +3 -exec rm {} \; > /dev/null 2>&1
log=/home/zhaoyingbin/`date +%F`_log
mkdir $log
date > $log/logs
who >> $log/logs
tail -n 300 /root/.bash_history >> $log/logs
cd /home/zhaoyingbin/
tar zcvf `date +%F`.tgz `date +%F`_log
rm -rf `date +%F`_log
scp -r /home/zhaoyingbin/`date +%F`.tgz *.*:/home/zhaoyingbin/
转载于:https://blog.51cto.com/loveqianqian/1011629