freebsd-ports/sysutils/rubygem-chef/files/chef_client.in
Philip M. Gollucci 51ad2120d1 The chef_client init script should set up the pidfile in
/var/run/chef-client.pid and instruct the chef-client process to write its PID
to this file when daemonizing. Without a pidfile, the status and onestatus
command fall back to process inspection. If chef is run with a resource defined
to :stop the chef_client service, such as chef-client::cron, then the
non-daemonized chef-client process effectivelly kills itself by running
/usr/local/etc/rc.d/chef_client status and /usr/local/etc/rc.d/chef_stop.

Run chef-client manually, then run /usr/local/etc/rc.d/chef_client onestatus.
The status will report chef-client running with the PID of the manually invoked
chef-client process.

- Bump PORTREVISION

Submitted by:   Scott Sanders <ssanders@taximagic.com> (private e-mail)
Approved by:    maintainer (implicit)
Feature safe:   yes
2012-03-22 17:53:44 +00:00

50 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: chef_client
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable chef-client
#
# chef_client_enable="YES"
. /etc/rc.subr
name="chef_client"
rcvar=chef_client_enable
# Read configuration and set defaults
load_rc_config $name
: ${chef_client_enable="NO"}
: ${chef_client_configfile="%%PREFIX%%/etc/chef/client.rb"}
: ${chef_client_interval="600"}
: ${chef_client_splay="0"}
: ${chef_client_logfile="/var/log/chef-client.log"}
: ${chef_client_loglevel="info"}
: ${chef_client_pidfile="/var/run/chef-client.pid"}
if [ -n "$chef_client_nodename" ]
then
nodename="-N ${chef_client_nodename}"
else
nodename=""
fi
if [ -n "$chef_client_server" ]
then
server="-N ${chef_client_server}"
else
server=""
fi
command="%%PREFIX%%/bin/chef-client"
command_interpreter="%%RUBY%%"
pidfile=${chef_client_pidfile}
chef_client_flags="-c ${chef_client_configfile} ${nodename}${server}-d -i ${chef_client_interval} -s ${chef_client_splay} -L ${chef_client_logfile} -l ${chef_client_loglevel} -P ${chef_client_pidfile}"
load_rc_config $name
run_rc_command "$1"