Initial Chef repository
This commit is contained in:
66
cookbooks/runit/templates/debian/init.d.erb
Normal file
66
cookbooks/runit/templates/debian/init.d.erb
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: <%= @name %>
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: initscript for runit-managed <%= @name %> service
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Chef Software, Inc. <cookbooks@chef.io>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="runit-managed <%= @name %>"
|
||||
NAME=<%= @name %>
|
||||
RUNIT=/usr/bin/sv
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if runit is not installed
|
||||
[ -x $RUNIT ] || exit 0
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
|
||||
$RUNIT start $NAME
|
||||
[ "$VERBOSE" != no ] && log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
$RUNIT stop $NAME
|
||||
[ "$VERBOSE" != no ] && log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
$RUNIT status $NAME && exit 0 || exit $?
|
||||
;;
|
||||
reload)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
$RUNIT reload $NAME
|
||||
[ "$VERBOSE" != no ] && log_end_msg $?
|
||||
;;
|
||||
force-reload)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Force reloading $DESC" "$NAME"
|
||||
$RUNIT force-reload $NAME
|
||||
[ "$VERBOSE" != no ] && log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
$RUNIT restart $NAME
|
||||
[ "$VERBOSE" != no ] && log_end_msg $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|reload|force-reload|restart}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
|
||||
24
cookbooks/runit/templates/default/log-config.erb
Normal file
24
cookbooks/runit/templates/default/log-config.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<% if @size -%>
|
||||
s<%= @size %>
|
||||
<% end -%>
|
||||
<% if @num -%>
|
||||
n<%= @num %>
|
||||
<% end -%>
|
||||
<% if @min -%>
|
||||
N<%= @min %>
|
||||
<% end -%>
|
||||
<% if @timeout -%>
|
||||
t<%= @timeout %>
|
||||
<% end -%>
|
||||
<% if @processor -%>
|
||||
!<%= @processor %>
|
||||
<% end -%>
|
||||
<% if @socket -%>
|
||||
u<%= @socket %>
|
||||
<% end -%>
|
||||
<% if @prefix -%>
|
||||
p<%= @prefix %>
|
||||
<% end -%>
|
||||
<% if @append -%>
|
||||
<%= @append %>
|
||||
<% end -%>
|
||||
32
cookbooks/runit/templates/gentoo/runit-start.sh.erb
Normal file
32
cookbooks/runit/templates/gentoo/runit-start.sh.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2006 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
depend() {
|
||||
after net
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting runsvdir"
|
||||
start-stop-daemon --start --exec /usr/bin/runsvdir \
|
||||
--background --make-pidfile \
|
||||
--pidfile /var/run/runsvdir.pid -- <%= node.runit.sv_dir %>
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
local ret1 ret2
|
||||
ebegin "Stopping runsvdir"
|
||||
start-stop-daemon --stop --oknodo --pidfile /var/run/runsvdir.pid
|
||||
ret1=$?
|
||||
eend ${ret1}
|
||||
|
||||
ebegin "Stopping services and logging"
|
||||
sv shutdown -w 10 <%= node.runit.sv_dir %>/*
|
||||
ret2=$?
|
||||
eend ${ret2}
|
||||
|
||||
return $((ret1+ret2))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user