Subversion Repositories ALCASAR

Rev

Rev 1358 | Rev 1583 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 1358 Rev 1400
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-archive.sh 1358 2014-05-23 12:26:25Z richard $
2
# $Id: alcasar-archive.sh 1400 2014-07-02 07:07: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 64... Line 64...
64
		fi
64
		fi
65
		nb_files=`ls $DIR_BASE/radius-*.sql 2>/dev/null | wc -w`
65
		nb_files=`ls $DIR_BASE/radius-*.sql 2>/dev/null | wc -w`
66
		if [ $nb_files -ne 0 ]; then
66
		if [ $nb_files -ne 0 ]; then
67
			mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) $DIR_TMP/
67
			mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) $DIR_TMP/
68
		fi
68
		fi
69
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
69
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
70
		nb_files=`find . -mtime -7 -name 'nfcapd.[0-9]*' | wc -l`
70
		nb_files=`find . -mtime -7 -name 'nfcapd.[0-9]*' | wc -l`
71
		if [ $nb_files -ne 0 ]; then
71
		if [ $nb_files -ne 0 ]; then
72
			find .  -mtime -7 -name 'nfcapd.[0-9]*' | xargs tar -cf $DIR_TMP/traceability-ALL-$NOW.tar;
72
			find .  -mtime -7 -name 'nfcapd.[0-9]*' | xargs tar -cf $DIR_TMP/traceability-ALL-$NOW.tar;
73
		fi
73
		fi
74
		cd /tmp/
74
		cd /tmp/
Line 115... Line 115...
115
		;;
115
		;;
116
	--live | -l)
116
	--live | -l)
117
		mkdir -p $DIR_ARCHIVE
117
		mkdir -p $DIR_ARCHIVE
118
		mkdir -p /tmp/live 
118
		mkdir -p /tmp/live 
119
		gap=$(($(date +%d)-1))
119
		gap=$(($(date +%d)-1))
120
		cd /var/log/nfsen/profiles-data/live/ipt_netflow
120
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
121
		find .  -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
121
		find .  -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
122
		/usr/local/sbin/alcasar-mysql.sh --dump
122
		/usr/local/sbin/alcasar-mysql.sh --dump
123
		mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) /tmp/live/
123
		mv $(echo $(ls -rt $DIR_BASE/radius-*.sql | tail -n 1 -)) /tmp/live/
124
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
124
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
125
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*
125
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*