From 96f25ace50f431417c380e7a155ee3d158f9bb29 Mon Sep 17 00:00:00 2001 From: Udo Waechter Date: Wed, 5 Jun 2013 15:56:03 +0200 Subject: [PATCH] appending to logfile --- files/puppetd_run.sh | 42 ------------------------------------ templates/puppetd_run.sh.erb | 2 +- 2 files changed, 1 insertion(+), 43 deletions(-) delete mode 100755 files/puppetd_run.sh diff --git a/files/puppetd_run.sh b/files/puppetd_run.sh deleted file mode 100755 index 404baf6..0000000 --- a/files/puppetd_run.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# a wrapper script, to run puppetd after a random time -# this will be called by cron at the same time on each client, -# but should not call the master at the same time as the others. -[ -e /etc/profile ] && . /etc/profile - -PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -PUPPET=$(which puppetd) -ISUNIIP=$(ifconfig |grep -c -e "131\.173\.3[2345]") - -if [ ${ISUNIIP} -gt 0 ]; then - if [ -e ${PUPPET} ]; then - #mac os X laptop check - if [ -e /usr/bin/pmset ]; then - if [ $(/usr/bin/pmset -g batt | grep -c "Battery Power") -eq 1 ]; then - #we are running on battery and do not want to do anything - exit 0 - fi - fi - #Linux laptop check - if [ -e /proc/acpi/ac_adapter/AC/state ]; then - if [ $(grep -c "on-line" /proc/acpi/ac_adapter/AC/state) -eq 0 ]; then - #we are running on battery and do not want to do anything - exit 0 - fi - fi - - MAXSLEEP=3200 #How many seconds to wait maximally - SLEEP=${RANDOM} - I=${RANDOM} - - # $RANDOM must be called several times, to ensure it really - # is something like random - for x in 1 2 3 4 5 6 7 8 9 10 11 12; do - SLEEP=${RANDOM} - done - # wait maximally $MAXSLEEP seconds - sleep $(expr ${SLEEP} % ${MAXSLEEP}) - # run puppetd - nice -n 12 $PUPPET -t 2&>/var/log/puppet/puppetd_run.log - fi -fi diff --git a/templates/puppetd_run.sh.erb b/templates/puppetd_run.sh.erb index a837967..84084cb 100755 --- a/templates/puppetd_run.sh.erb +++ b/templates/puppetd_run.sh.erb @@ -66,7 +66,7 @@ if [ ${ISUNIIP} -gt 0 ]; then # wait maximally $MAXSLEEP seconds sleep $(expr ${SLEEP} % ${MAXSLEEP}) # run puppetd - nice -n 12 $PUPPET agent -t 2&>/var/log/puppet/puppetd_run.log + nice -n 12 $PUPPET agent -t 2&>>/var/log/puppet/puppetd_run.log fi fi # cleanup the pidfile