From 565b86e547719051141a2a142c324a4c3f243ad2 Mon Sep 17 00:00:00 2001 From: David Starzengruber Date: Fri, 9 Jul 2010 00:03:11 +0200 Subject: [PATCH] commiting all --- mobots/README.please | 4 +++- mobots/df.sh | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mobots/README.please b/mobots/README.please index 5ef1f5b..d3ebb2a 100644 --- a/mobots/README.please +++ b/mobots/README.please @@ -18,8 +18,10 @@ use the df.conf.sample to create a config and put this file anywhere on the same http://gitorious.org/sn/scripts/trees/master/mobots/df.conf.sample 3. create a cronjob for it -add a line like this to your /etc/crontab (here the script is executed all 2 minutes) +add a line like this to your /etc/crontab */2 * * * * root /bin/bash --login /path/to/the/script/df.sh /path/to/configfile/df.conf >> /path/to/logfile/df.log +or (if you use the default configpath /etc/mobots) +*/5 * * * * root /bin/bash --login /path/to/script/df.sh >> /var/log/df.log after this you have to restart your cron with something like service cron restart diff --git a/mobots/df.sh b/mobots/df.sh index d28dc77..8ccfaec 100755 --- a/mobots/df.sh +++ b/mobots/df.sh @@ -6,6 +6,9 @@ ## ## ################################################### +## timestamp for logfile +timestamp=$(date '+%d %B %Y %H:%M') +echo "info: starting df bot $timestamp" ## check if sendxmpp is installed if [ $(aptitude search sendxmpp | awk '{print $1}') = "i" ]; then @@ -61,12 +64,13 @@ do datathreshold=$(echo $thresholds | awk '{print $'$i'}') if [ $data -gt $datathreshold ]; then - echo "info: $var reached threshold with $data, sending notification" - echo "$hostname: $var is running out of space: $data%" | sendxmpp -r dfmobot $watchdogs + echo "info: $var reached threshold with $data%, sending notification to $watchdogs" + echo "$hostname: $var is running out of space: $data%" | sendxmpp -r dfbot $watchdogs fi let i++ done ## exiting +echo "info: done" exit 0