Subversion Repositories ALCASAR

Rev

Rev 1247 | Rev 1263 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1247 Rev 1248
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-archive.sh 1247 2013-10-15 16:33:13Z crox53 $
2
# $Id: alcasar-archive.sh 1248 2013-10-21 16:18:20Z richard $
3
 
3
 
4
# alcasar-archive.sh
4
# alcasar-archive.sh
5
# by Franck BOUIJOUX and REXY
5
# by Franck BOUIJOUX and REXY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 56... Line 56...
56
		mkdir -p $DIR_ARCHIVE
56
		mkdir -p $DIR_ARCHIVE
57
		mkdir -p $DIR_TMP 
57
		mkdir -p $DIR_TMP 
58
		mv $(echo $(ls -rt $DIR_LOG/firewall/tracability.log*.gz | tail -n 1 -)) $DIR_TMP/tracability-HTTP.log-$NOW.gz
58
		mv $(echo $(ls -rt $DIR_LOG/firewall/tracability.log*.gz | tail -n 1 -)) $DIR_TMP/tracability-HTTP.log-$NOW.gz
59
		mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) $DIR_TMP/
59
		mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) $DIR_TMP/
60
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
60
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
61
		find . -mtime 0 -mtime -7 -name 'nfcapd.[0-9]*' | xargs tar -cf $DIR_TMP/tracability-ALL.log-$NOW.tar;
61
		find .  -mtime -7 -name 'nfcapd.[0-9]*' | xargs tar -cf $DIR_TMP/tracability-ALL.log-$NOW.tar;
62
		cd /tmp/
62
		cd /tmp/
63
		tar cvzf /tmp/$FILE archive-$NOW/*
63
		tar cvzf /tmp/$FILE archive-$NOW/*
64
} # end archive
64
} # end archive
65
 
65
 
66
#  Core script
66
#  Core script
Line 97... Line 97...
97
		;;
97
		;;
98
	--live | -l)
98
	--live | -l)
99
		mkdir -p /tmp/live 
99
		mkdir -p /tmp/live 
100
		gap=$(($(date +%d)-1))
100
		gap=$(($(date +%d)-1))
101
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
101
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
102
		find . -mtime 0 -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/tracability.log-$NOW.tar;
102
		find .  -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/tracability.log-$NOW.tar;
103
		cp $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) /tmp/live/
103
		cp $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) /tmp/live/
104
		cp /var/log/firewall/tracability.log /tmp/live/
104
		cp /var/log/firewall/tracability.log /tmp/live/
105
		tar -czf $DIR_ARCHIVE/tracability-$NOW.tar.gz /tmp/live/*
105
		tar -czf $DIR_ARCHIVE/tracability-$NOW.tar.gz /tmp/live/*
106
		rm -rf /tmp/live
106
		rm -rf /tmp/live
107
		;;
107
		;;