run daily, with collection log script
[monitor.git] / histlog / collect_log_sh
1 #!/bin/bash
2 function upload_log ()
3 {
4     file=$1
5     path=$2
6     old=/tmp/$( basename $file ).old
7     new=/tmp/$( basename $file ).new
8     log=/tmp/$( basename $file ).log
9     touch $old
10     cp $file $new
11     comm -1 -3 $old $new > $log
12     cp $new $old
13     if [ $( stat -c %s $log ) -ne 0 ] ; then 
14         curl --insecure https://monitor.planet-lab.org/monitor/uploadlogs --form "dir=$path" --form "log=@$log"
15     fi
16 }
17
18 upload_log ~/.bash_eternal_history hist
19 #upload_log /var/log/secure hist
20