Subversion Repositories ALCASAR

Rev

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

Rev 1695 Rev 1827
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-archive.sh 1695 2015-09-08 07:37:46Z franck $
2
# $Id: alcasar-archive.sh 1827 2016-04-19 09:47:29Z raphael.pion $
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 94... Line 94...
94
# Cleanup of files older than 365 days
94
# Cleanup of files older than 365 days
95
		cleanup
95
		cleanup
96
# make an archive
96
# make an archive
97
		archive
97
		archive
98
# Saving of the database
98
# Saving of the database
99
		/usr/local/sbin/alcasar-mysql.sh --dump
99
		/usr/local/bin/alcasar-mysql.sh --dump
100
# Encryption of the archive
100
# Encryption of the archive
101
 		if [ -e /tmp/$FILE ]; then 
101
 		if [ -e /tmp/$FILE ]; then 
102
			if [ $CRYPT -eq "1" ]; then
102
			if [ $CRYPT -eq "1" ]; then
103
			{
103
			{
104
				# 1 ) chiffrement/signature =1 ==> gpg --encrypt avec test de la clé présente
104
				# 1 ) chiffrement/signature =1 ==> gpg --encrypt avec test de la clé présente
Line 125... Line 125...
125
		mkdir -p /tmp/live 
125
		mkdir -p /tmp/live 
126
		gap=$(($(date +%e)-1))
126
		gap=$(($(date +%e)-1))
127
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
127
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
128
		find .  -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
128
		find .  -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
129
# Saving of the database
129
# Saving of the database
130
		/usr/local/sbin/alcasar-mysql.sh --dump
130
		/usr/local/bin/alcasar-mysql.sh --dump
131
		mv $(echo $(ls -rt $DIR_BASE/alcasar-users-database-*.sql.gz | tail -n 1 -)) /tmp/live/
131
		mv $(echo $(ls -rt $DIR_BASE/alcasar-users-database-*.sql.gz | tail -n 1 -)) /tmp/live/
132
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
132
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
133
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*
133
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*
134
		rm -rf /tmp/live
134
		rm -rf /tmp/live
135
		;;
135
		;;