标签:日志迁移
#!/bin/bash
#install s3cmd
cd /etc/yum.repos.d
wget http://s3tools.org/repo/RHEL_6/s3tools.repo
if [ ! -d "/usr/local/scripts/" ] ; then
mkdir -p /usr/local/scripts/;
fi
#upload the migrate logs script to /usr/local/scripts
scp $ATTACH_DIR/migrate-log.sh /usr/local/scripts
echo "0 */1 * * * /usr/local/scripts/migrate-log.sh > /dev/null 2>&1" >>/var/spool/cron/root
#add crontab entry
#upload backup files to s3
DATE=`date +%Y-%m-%d`
cd /mnt/ephemeral/karaf/data/
tar zcvf web-messaging-service.log.${DATE}tar.gz log
#save a copy to s3
s3cmd put --force web-messaging-service.log.${DATE}tar.gz s3://wms-gameexternal-log/
rm -f /mnt/ephemeral/karaf/data/web-messaging-service.log.${DATE}tar.gz
find /mnt/ephemeral/karaf/data/log/ -type f -name "karaf.log.20*" -exec rm -f {} \;
本文出自 “小V运维之路” 博客,请务必保留此出处http://victor2016.blog.51cto.com/6768693/1914459
标签:日志迁移
原文地址:http://victor2016.blog.51cto.com/6768693/1914459