some refactoring, externalizing classes

This commit is contained in:
do
2013-05-05 21:06:45 +02:00
parent aaea443943
commit fb837f76a9
7 changed files with 130 additions and 93 deletions

View File

@@ -14,7 +14,7 @@ export FACTERLIB="<%= scope.lookupvar("factpath") %>"
PATH="/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PUPPET=$(which puppet)
[[ -e ${PUPPET} ]] || exit 1
PUPPET="${PUPPET} agent"
PUPPET="${PUPPET}"
<% if run_if_ipmatch != "" -%>
ISUNIIP=$(ifconfig |grep -c -e "<%= run_if_ipmatch %>")
<% else -%>
@@ -30,7 +30,7 @@ function cleanup {
if [ -e ${PIDF} ]; then
PID=`cat ${PIDF}`
if [ $(ps -eo pid |grep -c ${PID}) -gt 1 ]; then
if [ $(ps -eo pid |grep -c ${PID}) -gt 0 ]; then
exit 0
fi
fi
@@ -66,7 +66,7 @@ if [ ${ISUNIIP} -gt 0 ]; then
# wait maximally $MAXSLEEP seconds
sleep $(expr ${SLEEP} % ${MAXSLEEP})
# run puppetd
nice -n 12 $PUPPET -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