Update init.d script to allow custom service name

This commit is contained in:
Ross Perkins 2014-11-07 21:55:54 -08:00
parent 3a158a278c
commit 2a679f9597
2 changed files with 8 additions and 7 deletions

View File

@ -222,6 +222,7 @@ nginx:
- group: root - group: root
- mode: 0755 - mode: 0755
- context: - context:
service_name: {{ service_name }}
sbin_dir: {{ sbin_dir }} sbin_dir: {{ sbin_dir }}
pid_path: {{ pid_path }} pid_path: {{ pid_path }}
service: service:

View File

@ -1,23 +1,23 @@
#!/bin/sh #!/bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: nginx # Provides: {{ service_name }}
# Required-Start: $local_fs $remote_fs $network $syslog # Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: starts the nginx web server # Short-Description: starts the {{ service_name }} web server
# Description: starts nginx using start-stop-daemon # Description: starts {{ service_name }} using start-stop-daemon
### END INIT INFO ### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON={{ sbin_dir }}/nginx DAEMON={{ sbin_dir }}/nginx
NAME=nginx NAME={{ service_name }}
DESC=nginx DESC={{ service_name }}
# Include nginx defaults if available # Include nginx defaults if available
if [ -f /etc/default/nginx ]; then if [ -f /etc/default/$NAME ]; then
. /etc/default/nginx . /etc/default/$NAME
fi fi
test -x $DAEMON || exit 0 test -x $DAEMON || exit 0