git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.planet-lab.org/git/monitor
[monitor.git]
/
histlog
/
collect_log_sh
diff --git
a/histlog/collect_log_sh
b/histlog/collect_log_sh
index
b8d535e
..
91dd0fb
100644
(file)
--- a/
histlog/collect_log_sh
+++ b/
histlog/collect_log_sh
@@
-6,15
+6,23
@@
function upload_log ()
old=/tmp/$( basename $file ).old
new=/tmp/$( basename $file ).new
log=/tmp/$( basename $file ).log
old=/tmp/$( basename $file ).old
new=/tmp/$( basename $file ).new
log=/tmp/$( basename $file ).log
- touch $old
+ if [ -f $new ] ; then
+ cp $new $old
+ else
+ touch $old
+ fi
cp $file $new
comm -1 -3 $old $new > $log
cp $file $new
comm -1 -3 $old $new > $log
- cp $new $old
- if [ $( stat -c %s $log ) -ne 0 ] ; then
+ if [ $( stat -c %s $log ) -ne 0 ] ; then
curl --insecure https://monitor.planet-lab.org/monitor/uploadlogs --form "dir=$path" --form "log=@$log"
curl --insecure https://monitor.planet-lab.org/monitor/uploadlogs --form "dir=$path" --form "log=@$log"
+ if [ $? -ne 0 ] ; then
+ # the upload has failed, so remove new file so no data is lost
+ rm -f /tmp/$( basename $file ).new
+ fi
fi
}
fi
}
+
upload_log ~/.bash_eternal_history hist
#upload_log /var/log/secure hist
upload_log ~/.bash_eternal_history hist
#upload_log /var/log/secure hist