Sha256: be08b372d626222d83798322f7fa7fe288ce7fae511c984395dc13932b05003f

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

#!/sbin/sh
# It needs the smf property puppet-agent/server to be set to where the server is.
# svccfg -s svc:/network/puppet/agent setprop server/name=asstring:localhost


. /lib/svc/share/smf_include.sh

[[ -z "${SMF_FMRI}" ]] && exit $SMF_EXIT_ERR

typeset -r CONF_FILE=/etc/puppet/puppet.conf
[[ ! -f "${CONF_FILE}" ]] && exit $SMF_EXIT_ERR_CONFIG

typeset -r PUPPET=/usr/bin/puppet
typeset -r PUPPET_SERVER=$(svcprop -p server/name $SMF_FMRI)
[[ -z "${PUPPET_SERVER}" ]] && exit $SMF_EXIT_ERR_CONFIG

case "$1" in
start)
  exec $PUPPET agent --daemonize --server $PUPPET_SERVER
  ;;

stop)
  # stop sends sigterm first followed by sigkill
  # smf_kill_contract <CTID> TERM 1 30
  # sends sigterm to all process in ctid and will continue
  # to do so for 30 seconds with interval of 5 seconds
  # smf_kill_contract <CTID> KILL 1
  # continues until all processes are killed.
  # svcs -p <fmri> lists all processes in the contract.
  # http://bnsmb.de/solaris/My_Little_SMF_FAQ.html
  ctid=`svcprop -p restarter/contract $SMF_FMRI`
  if [ -n "$ctid" ]; then
    smf_kill_contract $ctid TERM 1 5
    ret=$?
    [ $ret -eq 1 ] && exit $SMF_EXIT_ERR_FATAL

    if [ $ret -eq 2 ] ; then
      smf_kill_contract $ctid KILL 1
      [ $? -ne 0 ] && exit $SMF_EXIT_ERR_FATAL
    fi
  fi
  ;;
*)
  echo "Usage: $0 {start|stop}";
  exit $SMF_EXIT_ERR_FATAL
  ;;
esac
exit $SMF_EXIT_OK

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-3.0.2 ext/ips/puppet-agent
puppet-3.0.2.rc3 ext/ips/puppet-agent
puppet-3.0.2.rc2 ext/ips/puppet-agent
puppet-3.0.2.rc1 ext/ips/puppet-agent
puppet-3.0.1 ext/ips/puppet-agent
puppet-3.0.1.rc1 ext/ips/puppet-agent
puppet-3.0.0 ext/ips/puppet-agent
puppet-3.0.0.rc8 ext/ips/puppet-agent
puppet-3.0.0.rc7 ext/ips/puppet-agent