initial
This commit is contained in:
23
files/.svn/text-base/org.macports.puppet.plist.svn-base
Normal file
23
files/.svn/text-base/org.macports.puppet.plist.svn-base
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
|
||||
<plist version='1.0'>
|
||||
<dict>
|
||||
<key>Label</key><string>org.macports.puppet</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/opt/local/bin/daemondo</string>
|
||||
<string>--label=puppet</string>
|
||||
<string>--start-cmd</string>
|
||||
<string>/opt/local/sbin/puppetd</string>
|
||||
<string>--no-daemonize</string>
|
||||
<string>--verbose</string>
|
||||
<string>;</string>
|
||||
<string>--pid=exec</string>
|
||||
</array>
|
||||
<key>Debug</key><false/>
|
||||
<key>Disabled</key><true/>
|
||||
<key>OnDemand</key><false/>
|
||||
<key>RunAtLoad</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
44
files/.svn/text-base/puppetd_run.sh.svn-base
Normal file
44
files/.svn/text-base/puppetd_run.sh.svn-base
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
|
||||
# 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.
|
||||
export FACTERLIB="/var/lib/puppet/facts"
|
||||
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
|
||||
Reference in New Issue
Block a user