report_options: Syntax fix
[ninja.git] / test / unit_test / reports / send-logs.sh
blob8c7fa720eb16fe055714394fc5bec59969de97d5
1 #!/bin/sh
3 ftp_server=reports.op5.com
5 ftp_send()
7 echo "Sending $1 to $ftp_server"
8 lftp $ftp_server -e "cd upload; put $1; exit"
11 if [ "$1" -a -f "$1" ]; then
12 ftp_send "$1"
13 exit $?
16 [ "$1" ] && tarfile="$1.tar.bz2" || tarfile=logs-config-$(date +%s).tar.bz2
18 cfg_files=$(mktemp /tmp/config-files.XXXXXX)
19 sed -n 's/^cfg_file=//p' /opt/monitor/etc/nagios.cfg > $cfg_files
20 for d in $(grep ^cfg_dir /opt/monitor/etc/nagios.cfg); do
21 find $d -type f -name "*.cfg" >> $cfg_files
22 done
23 tar -p -P -c -v -j -f $tarfile \
24 $(cat $cfg_files) \
25 /opt/monitor/var/nagios.log \
26 /opt/monitor/var/archives/nagios-*.log
28 ftp_send $tarfile