From: Jochen M. <j.m...@om...> - 2004-09-16 09:02:11
|
Hi Rene, Hi Joe, hi folks, one of my clients has bobs server running, and as you know I like. Today I have come across the problem of security, concerning, that the system (bobs server) is still alive. This is a great problem for me. Because as this company does not have an administration or something, I let the system run and do not control it every day. Know I figured out that backup system was dead for a long time. As I - shame on me - figured out, it occured by a stresstest of mine, producing new backups every 5 minutes. So the system did not make backups for a couple of .... ( that is my secret ;o) ). To solve this, I think it would be nice, to do some simple email reporting. I hacked this on bobs 0.6.0 or 0.6.1 I suppose. I am not firm to the new version, where check_loop runs as a service as I could see in the lists. So here are my changings I did on 0.6.x < 0.6.2 1. Hacked check_loop: # new part, to be informed when system stucks !! ADMIN_EMAIL=j.m...@om... # seconds that are o.k. since last action in SECONDS # we use 7 days here = MAX_NO_ACTION=604800 # for testing #MAX_NO_ACTION=4 # check if CMDLOOP_DIR"last_run" if [ -f "$CMDLOOP_DIR""/last_run" ]; then LASTRUN=$(cat $CMDLOOP_DIR"/last_run") # security option if [ "$LASTRUN" = "" ]; then LASTRUN=0; fi CURRENT_TIME=$(date +"%s") # calculate diff let DIFF_TIME=$CURRENT_TIME-$LASTRUN if [ $DIFF_TIME -gt $MAX_NO_ACTION ]; then echo "No action for too long" >> /var/log/bobs echo "ERRORREPORT" | mail -s "[BOBS] No action for too long" $ADMIN_MAIL fi else echo "Sorry, does not exits yet"; fi if [ "$CMDLOOP_PID" == "" ] then 2. Hacked cmdloop if [ -e $file ] then echo "Starting $file" # write current time to last_run date +"%s" > $PWD"/last_run" # ${file##*.} resolves to the extension of the file name # File name 'cmd.1048828727.bash' resolves to just 'bash' # See 'parameter expansion' in 'info bash' ${file##*.} $file $DELCMD $file echo "Finished $file" else continue fi done That is it... The thing that can occur, that the system hangs in a cmd... - execution - I believe. So what do you think of it ? Cheers Jochen Jochen Metzger j.m...@om... http://hosting.omatix.de |