diff options
author | Seth Chisamore <schisamo@opscode.com> | 2012-10-30 10:39:35 -0400 |
---|---|---|
committer | Seth Chisamore <schisamo@opscode.com> | 2012-10-30 10:39:35 -0400 |
commit | 24dc69a9a97e82a6e4207de68d6dcc664178249b (patch) | |
tree | 19bb289c9f88b4bbab066bc56b95d6d222fd5c35 /distro/debian | |
parent | 9348c1c9c80ee757354d624b7dc1b78ebc7605c4 (diff) | |
download | chef-24dc69a9a97e82a6e4207de68d6dcc664178249b.tar.gz |
[OC-3564] move core Chef to the repo root \o/ \m/
The opscode/chef repository now only contains the core Chef library code
used by chef-client, knife and chef-solo!
Diffstat (limited to 'distro/debian')
-rw-r--r-- | distro/debian/etc/default/chef-client | 4 | ||||
-rw-r--r-- | distro/debian/etc/default/chef-expander | 8 | ||||
-rw-r--r-- | distro/debian/etc/default/chef-server | 9 | ||||
-rw-r--r-- | distro/debian/etc/default/chef-server-webui | 9 | ||||
-rw-r--r-- | distro/debian/etc/default/chef-solr | 8 | ||||
-rwxr-xr-x | distro/debian/etc/init.d/chef-client | 210 | ||||
-rwxr-xr-x | distro/debian/etc/init.d/chef-expander | 176 | ||||
-rwxr-xr-x | distro/debian/etc/init.d/chef-server | 122 | ||||
-rwxr-xr-x | distro/debian/etc/init.d/chef-server-webui | 123 | ||||
-rwxr-xr-x | distro/debian/etc/init.d/chef-solr | 176 | ||||
-rw-r--r-- | distro/debian/etc/init/chef-client.conf | 17 | ||||
-rw-r--r-- | distro/debian/etc/init/chef-expander.conf | 17 | ||||
-rw-r--r-- | distro/debian/etc/init/chef-server-webui.conf | 17 | ||||
-rw-r--r-- | distro/debian/etc/init/chef-server.conf | 17 | ||||
-rw-r--r-- | distro/debian/etc/init/chef-solr.conf | 17 |
15 files changed, 930 insertions, 0 deletions
diff --git a/distro/debian/etc/default/chef-client b/distro/debian/etc/default/chef-client new file mode 100644 index 0000000000..a6413a30d4 --- /dev/null +++ b/distro/debian/etc/default/chef-client @@ -0,0 +1,4 @@ +LOGFILE=/var/log/chef/client.log +CONFIG=/etc/chef/client.rb +INTERVAL=1800 +SPLAY=20 diff --git a/distro/debian/etc/default/chef-expander b/distro/debian/etc/default/chef-expander new file mode 100644 index 0000000000..3d855705ba --- /dev/null +++ b/distro/debian/etc/default/chef-expander @@ -0,0 +1,8 @@ +LOGFILE=/var/log/chef/expander.log +CONFIG=/etc/chef/solr.rb +USER=chef +GROUP=chef +# Sleep to give daemon enough time to fully start or stop. +DIETIME=5 +STARTTIME=5 +CHEF_EXPANDER_ARGS="-n 1 -i 1" diff --git a/distro/debian/etc/default/chef-server b/distro/debian/etc/default/chef-server new file mode 100644 index 0000000000..b91a3ce81c --- /dev/null +++ b/distro/debian/etc/default/chef-server @@ -0,0 +1,9 @@ +LOGFILE=/var/log/chef/server.log +CONFIG=/etc/chef/server.rb +ADAPTER=thin +PORT=4000 +USER=chef +GROUP=chef +# Sleep to give daemon enough time to fully start or stop. +STARTTIME=10 +DIETIME=5 diff --git a/distro/debian/etc/default/chef-server-webui b/distro/debian/etc/default/chef-server-webui new file mode 100644 index 0000000000..50dd22a288 --- /dev/null +++ b/distro/debian/etc/default/chef-server-webui @@ -0,0 +1,9 @@ +LOGFILE=/var/log/chef/server-webui.log +CONFIG=/etc/chef/webui.rb +ADAPTER=thin +PORT=4040 +USER=chef +GROUP=chef +# Sleep to give daemon enough time to fully start or stop. +STARTTIME=10 +DIETIME=5 diff --git a/distro/debian/etc/default/chef-solr b/distro/debian/etc/default/chef-solr new file mode 100644 index 0000000000..7f5220c058 --- /dev/null +++ b/distro/debian/etc/default/chef-solr @@ -0,0 +1,8 @@ +LOGFILE=/var/log/chef/solr.log +CONFIG=/etc/chef/solr.rb +USER=chef +GROUP=chef +# Sleep to give daemon enough time to fully start or stop. +DIETIME=5 +STARTTIME=5 +MAXTRIES=20 diff --git a/distro/debian/etc/init.d/chef-client b/distro/debian/etc/init.d/chef-client new file mode 100755 index 0000000000..8f99748f59 --- /dev/null +++ b/distro/debian/etc/init.d/chef-client @@ -0,0 +1,210 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: chef-client +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a chef-client. +### END INIT INFO +# +# Copyright (c) 2009-2010 Opscode, Inc, <legal@opscode.com> +# +# chef-client Startup script for chef-client. +# chkconfig: - 99 02 +# description: starts up chef-client in daemon mode. + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=$(which chef-client) +NAME=chef-client +DESC=chef-client +PIDFILE=/var/run/chef/client.pid + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! -d /var/run/chef ]; then + mkdir /var/run/chef +fi + +DAEMON_OPTS="-d -P $PIDFILE -c $CONFIG -i $INTERVAL -s $SPLAY" + +if [ ! -z $LOGFILE ]; then + DAEMON_OPTS="${DAEMON_OPTS} -L $LOGFILE" +fi + +running_pid() { + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`awk '/Name:/ {print $2}' /proc/$pid/status` + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() { + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` + running_pid $pid $NAME || return 1 + return 0 +} + +start_server() { + if [ -z "$DAEMONUSER" ] ; then + start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS + errcode=$? + else + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --chuid $DAEMONUSER \ + --exec $DAEMON -- $DAEMON_OPTS + errcode=$? + fi + return $errcode +} + +stop_server() { + if [ -z "$DAEMONUSER" ] ; then + killproc -p $PIDFILE $DAEMON + errcode=$? + else + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER \ + --exec $DAEMON + errcode=$? + fi + return $errcode +} + +reload_server() { + if [ -z "$DAEMONUSER" ] ; then + killproc -p $PIDFILE $DAEMON -HUP + errcode=$? + else + start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER \ + --exec $DAEMON + errcode=$? + fi + return $errcode +} + +run_server() { + if [ -z "$DAEMONUSER" ] ; then + killproc -p $PIDFILE $DAEMON -USR1 + errcode=$? + else + start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER \ + --exec $DAEMON + errcode=$? + fi + return $errcode +} + +force_stop() { + [ ! -e "$PIDFILE" ] && return + if running ; then + /bin/kill -15 $pid + sleep "$DIETIME"s + if running ; then + /bin/kill -9 $pid + sleep "$DIETIME"s + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC " "$NAME" + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 0 + fi + if start_server ; then + [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time + if running ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if running ; then + errcode=0 + stop_server || errcode=$? + log_end_msg $errcode + else + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + force-stop) + $0 stop + if running; then + log_daemon_msg "Stopping (force) $DESC" "$NAME" + errcode=0 + force_stop || errcode=$? + log_end_msg $errcode + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + errcode=0 + stop_server || errcode=$? + [ -n "$DIETIME" ] && sleep $DIETIME + start_server || errcode=$? + [ -n "$STARTTIME" ] && sleep $STARTTIME + running || errcode=$? + log_end_msg $errcode + ;; + status) + log_daemon_msg "Checking status of $DESC" "$NAME" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 3 + fi + ;; + reload) + if running; then + log_daemon_msg "Reloading $DESC" "$NAME" + errcode=0 + reload_server || errcode=$? + log_end_msg $errcode + fi + ;; + run) + if running; then + log_daemon_msg "Triggering run of $DESC" "$NAME" + errcode=0 + run_server || errcode=$? + log_end_msg $errcode + fi + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status|run}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/distro/debian/etc/init.d/chef-expander b/distro/debian/etc/init.d/chef-expander new file mode 100755 index 0000000000..7fea0e9118 --- /dev/null +++ b/distro/debian/etc/init.d/chef-expander @@ -0,0 +1,176 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: chef-expander +# Required-Start: $remote_fs $network rabbitmq-server chef-solr +# Required-Stop: $remote_fs $network rabbitmq-server chef-solr +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a chef-expander. +### END INIT INFO +# +# Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com> +# +# chef-expander Startup script for chef-expander. +# chkconfig: - 85 02 +# description: starts up chef-expander in daemon mode. + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=$(which chef-expander) +NAME=chef-expander +DESC=chef-expander +PIDFILE=/var/run/chef/expander.pid + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! -d /var/run/chef ]; then + mkdir /var/run/chef + chown $USER:$GROUP /var/run/chef +fi + +DAEMON_OPTS="-d -c $CONFIG -P $PIDFILE -L $LOGFILE $CHEF_EXPANDER_ARGS" + +running_pid() { + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | awk 'NR==2'` + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() { + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` + running_pid $pid $DAEMON || return 1 + return 0 +} + +start_server() { + if [ -z "$DAEMONUSER" ] ; then + start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS + errcode=$? + else + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --chuid $DAEMONUSER \ + --exec $DAEMON -- $DAEMON_OPTS + errcode=$? + fi + return $errcode +} + +stop_server() { + if [ -z "$DAEMONUSER" ] ; then + killproc -p $PIDFILE $DAEMON + errcode=$? + else + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER \ + --exec $DAEMON + errcode=$? + fi + return $errcode +} + +reload_server() { + [ ! -f "$PIDFILE" ] && return 1 + pid=pidofproc $PIDFILE # This is the daemon's pid + /bin/kill -1 $pid + return $? +} + +force_stop() { + [ ! -e "$PIDFILE" ] && return + if running ; then + /bin/kill -15 $pid + sleep "$DIETIME"s + if running ; then + /bin/kill -9 $pid + sleep "$DIETIME"s + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC " "$NAME" + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 3 + fi + if start_server ; then + [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time + if running ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if running ; then + errcode=0 + stop_server || errcode=$? + log_end_msg $errcode + else + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + force-stop) + $0 stop + if running; then + log_daemon_msg "Stopping (force) $DESC" "$NAME" + errcode=0 + force_stop || errcode=$? + log_end_msg $errcode + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + errcode=0 + stop_server || errcode=$? + [ -n "$DIETIME" ] && sleep $DIETIME + start_server || errcode=$? + [ -n "$STARTTIME" ] && sleep $STARTTIME + running || errcode=$? + log_end_msg $errcode + ;; + status) + log_daemon_msg "Checking status of $DESC" "$NAME" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 1 + fi + ;; + reload) + log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" + log_warning_msg "cannot re-read the config file (use restart)." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/distro/debian/etc/init.d/chef-server b/distro/debian/etc/init.d/chef-server new file mode 100755 index 0000000000..f7c1ede583 --- /dev/null +++ b/distro/debian/etc/init.d/chef-server @@ -0,0 +1,122 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: chef-server +# Required-Start: $remote_fs $network rabbitmq-server couchdb +# Required-Stop: $remote_fs $network rabbitmq-server couchdb +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a chef-server. +### END INIT INFO +# +# Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com> +# +# chef-server Startup script for chef-server. +# chkconfig: - 90 02 +# description: starts up chef-server webui. + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=$(which chef-server) +PIDFILE=/var/run/chef/server.%s.pid +MAINPID=/var/run/chef/server.main.pid +NAME=chef-server +DESC=chef-server + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! -d /var/run/chef ]; then + mkdir /var/run/chef + chown $USER:$GROUP /var/run/chef +fi + +DAEMON_OPTS="-p $PORT -e production -d -a $ADAPTER -P $PIDFILE -L $LOGFILE -C $CONFIG -u $USER -G $GROUP" + +running() { + [ ! -f "$MAINPID" ] && return 1 + pid=`cat $MAINPID` + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + (ps -fp $pid | egrep -q "merb.*(merb : master|worker.*$PORT)") || return 1 + return 0 +} + +start_server() { + $DAEMON $DAEMON_OPTS + errcode=$? + return $errcode +} + +stop_server() { + $DAEMON -K all -P $PIDFILE + errcode=$? + return $errcode +} + +reload_server() { + stop_server + [ -n "$DIETIME" ] && sleep $DIETIME + start_server + [ -n "$STARTTIME" ] && sleep $STARTTIME +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC " + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 0 + fi + if start_server ; then + [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time + if running ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" + if running ; then + errcode=0 + stop_server || errcode=$? + log_end_msg $errcode + else + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" + errcode=0 + reload_server + running && errcode=$? + log_end_msg $errcode + ;; + status) + log_daemon_msg "Checking status of $DESC" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 3 + fi + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|status}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/distro/debian/etc/init.d/chef-server-webui b/distro/debian/etc/init.d/chef-server-webui new file mode 100755 index 0000000000..c82171cedb --- /dev/null +++ b/distro/debian/etc/init.d/chef-server-webui @@ -0,0 +1,123 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: chef-server-webui +# Required-Start: $remote_fs $network chef-server +# Required-Stop: $remote_fs $network chef-server +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a chef-server-webui +### END INIT INFO +# +# Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com> +# +# chef-server-webui Startup script for chef-server-webui. +# chkconfig: - 95 02 +# description: starts up chef-server webui. + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=$(which chef-server-webui) +PIDFILE=/var/run/chef/server-webui.%s.pid +MAINPID=/var/run/chef/server-webui.main.pid +NAME=chef-server-webui +DESC=chef-server-webui + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! -d /var/run/chef ]; then + mkdir /var/run/chef + chown $USER:$GROUP /var/run/chef +fi + +DAEMON_OPTS="-p $PORT -e production -d -a $ADAPTER -P $PIDFILE -L $LOGFILE -C $CONFIG -u $USER -G $GROUP" + +running() { + [ ! -f "$MAINPID" ] && return 1 + pid=`cat $MAINPID` + name=$WORKER + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + (ps -fp $pid | egrep -q "merb.*(merb : master|worker.*$PORT)") || return 1 + return 0 +} + +start_server() { + $DAEMON $DAEMON_OPTS + errcode=$? + return $errcode +} + +stop_server() { + $DAEMON -K all -P $PIDFILE + errcode=$? + return $errcode +} + +reload_server() { + stop_server + [ -n "$DIETIME" ] && sleep $DIETIME + start_server + [ -n "$STARTTIME" ] && sleep $STARTTIME +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC " + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 0 + fi + if start_server ; then + [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time + if running ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" + if running ; then + errcode=0 + stop_server || errcode=$? + log_end_msg $errcode + else + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" + errcode=0 + reload_server + running && errcode=$? + log_end_msg $errcode + ;; + status) + log_daemon_msg "Checking status of $DESC" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 3 + fi + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|status}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/distro/debian/etc/init.d/chef-solr b/distro/debian/etc/init.d/chef-solr new file mode 100755 index 0000000000..1e4c0b8b51 --- /dev/null +++ b/distro/debian/etc/init.d/chef-solr @@ -0,0 +1,176 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: chef-solr +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a chef-solr. +### END INIT INFO +# +# Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com> +# +# chef-solr Startup script for chef-solr. +# chkconfig: - 84 02 +# description: starts up chef-solr in daemon mode. + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=$(which chef-solr) +DAEMON_NAME=java +NAME=chef-solr +DESC=chef-solr +PIDFILE=/var/run/chef/solr.pid + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! -d /var/run/chef ]; then + mkdir /var/run/chef + chown $USER:$GROUP /var/run/chef +fi + +if [ ! -f $LOGFILE ]; then + touch $LOGFILE + chown $USER:$GROUP $LOGFILE +fi + +DAEMON_OPTS="-d -P $PIDFILE -c $CONFIG -L $LOGFILE -u $USER -g $GROUP" + +running_pid() { + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | head -1` + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() { + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` + running_pid $pid $DAEMON_NAME || return 1 + return 0 +} + +start_server() { + start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS + errcode=$? + for i in `seq 0 $MAXTRIES` + do + if running; then + errcode=0 + break + else + [ -n "$STARTTIME" ] && sleep $STARTTIME + fi + done + return $errcode +} + +stop_server() { + killproc -p $PIDFILE $DAEMON + errcode=$? + return $errcode +} + +reload_server() { + [ ! -f "$PIDFILE" ] && return 1 + pid=pidofproc $PIDFILE # This is the daemon's pid + /bin/kill -1 $pid + return $? +} + +force_stop() { + [ ! -e "$PIDFILE" ] && return + if running ; then + /bin/kill -15 $pid + sleep "$DIETIME"s + if running ; then + /bin/kill -9 $pid + sleep "$DIETIME"s + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC " "$NAME" + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 3 + fi + if start_server ; then + [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time + if running ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if running ; then + errcode=0 + stop_server || errcode=$? + log_end_msg $errcode + else + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + force-stop) + $0 stop + if running; then + log_daemon_msg "Stopping (force) $DESC" "$NAME" + errcode=0 + force_stop || errcode=$? + log_end_msg $errcode + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + errcode=0 + stop_server || errcode=$? + [ -n "$DIETIME" ] && sleep $DIETIME + start_server || errcode=$? + [ -n "$STARTTIME" ] && sleep $STARTTIME + running || errcode=$? + log_end_msg $errcode + ;; + status) + log_daemon_msg "Checking status of $DESC" "$NAME" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 1 + fi + ;; + reload) + log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" + log_warning_msg "cannot re-read the config file (use restart)." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/distro/debian/etc/init/chef-client.conf b/distro/debian/etc/init/chef-client.conf new file mode 100644 index 0000000000..1f8c6d0d9b --- /dev/null +++ b/distro/debian/etc/init/chef-client.conf @@ -0,0 +1,17 @@ +# chef-client - Chef Configuration Management Client +# +# Chef Client provides the Chef configuration management daemon + +description "Chef Client" + +start on filesystem +stop on runlevel [!2345] + +respawn +respawn limit 5 30 + +pre-start script + test -x /usr/bin/chef-client || { stop; exit 0; } +end script + +exec /usr/bin/chef-client -i 1800 -L /var/log/chef/client.log diff --git a/distro/debian/etc/init/chef-expander.conf b/distro/debian/etc/init/chef-expander.conf new file mode 100644 index 0000000000..21ff246307 --- /dev/null +++ b/distro/debian/etc/init/chef-expander.conf @@ -0,0 +1,17 @@ +# chef-expander - Chef Expander +# +# Chef Expander provides indexing of Solr for Chef Server + +description "Chef Expander" + +start on filesystem +stop on runlevel [!2345] + +respawn +respawn limit 5 30 + +pre-start script + test -x /usr/bin/chef-expander || { stop; exit 0; } +end script + +exec /usr/bin/chef-expander -c /etc/chef/solr.rb -L /var/log/chef/expander.log -n 1 -i 1 diff --git a/distro/debian/etc/init/chef-server-webui.conf b/distro/debian/etc/init/chef-server-webui.conf new file mode 100644 index 0000000000..8b443c51f5 --- /dev/null +++ b/distro/debian/etc/init/chef-server-webui.conf @@ -0,0 +1,17 @@ +# chef-server-webui - Chef Server WebUI +# +# Chef Server WebUI provides the browser-accessible UI to the Chef Server API + +description "Chef Server WebUI" + +start on filesystem +stop on runlevel [!2345] + +respawn +respawn limit 5 30 + +pre-start script + test -x /usr/bin/chef-server-webui || { stop; exit 0; } +end script + +exec /usr/bin/chef-server-webui -e production -p 4040 -L /var/log/chef/server-webui.log diff --git a/distro/debian/etc/init/chef-server.conf b/distro/debian/etc/init/chef-server.conf new file mode 100644 index 0000000000..1eebd8f0cb --- /dev/null +++ b/distro/debian/etc/init/chef-server.conf @@ -0,0 +1,17 @@ +# chef-server - Chef Server +# +# Chef Server provides the Chef API server + +description "Chef Server API" + +start on filesystem +stop on runlevel [!2345] + +respawn +respawn limit 5 30 + +pre-start script + test -x /usr/bin/chef-server || { stop; exit 0; } +end script + +exec /usr/bin/chef-server -e production -p 4000 -L /var/log/chef/server.log diff --git a/distro/debian/etc/init/chef-solr.conf b/distro/debian/etc/init/chef-solr.conf new file mode 100644 index 0000000000..4ca885e28d --- /dev/null +++ b/distro/debian/etc/init/chef-solr.conf @@ -0,0 +1,17 @@ +# chef-solr - Chef Solr +# +# Chef Solr provides Solr search for Chef Server + +description "Chef Solr" + +start on filesystem +stop on runlevel [!2345] + +respawn +respawn limit 5 30 + +pre-start script + test -x /usr/bin/chef-solr || { stop; exit 0; } +end script + +exec /usr/bin/chef-solr -c /etc/chef/solr.rb -L /var/log/chef/solr.log |