TARscripts

From CoolSolutionsWiki

-my other wikis

Useful bash scripts to tar/zip/ftp upload files to novell.

tarlogs.sh


#!/bin/bash
# run this daily at 10pm
tar -zcvf "/root/gen/mc.logs.messages.`date +%F`.tar.gz" /var/log/messages
tar -zcvf "/root/gen/mc.logs.mta.`date +%F`.tar.gz" /var/log/novell/groupwise/
tar -zcvf "/root/gen/mc.logs.poa.`date +%F`.tar.gz" /gwise/poname/groupwise/agents/log/
#chown -R gwuser:users /gwise
loc="/root/"
fileput="mc.all.logs.$(date +%F)mail2.bz2" tar -cjvf /root/$fileput /root/gen
# now upload it to novell
/usr/bin/ftp -inv ftp.novell.com<<ENDFTP
user anonymous me@you.com
cd incoming
bin
lcd $loc
put $fileput
bye
ENDFTP
echo `date` >> /root/file1.txt

tarclean.sh

#!/bin/bash # this script cleans up all the old mc.all.logs.date # run this once a week - Friday 9pm
cd /root
rm mc*
cd gen
rm mc*

/etc/cron.d/genscript


#crontab for tarlogs
#run tarlogs
5 22 * * * root /root/tarlogs.sh
#run clean up tar logs
4 20 * * * root /root/tarclean.sh