Changed the template a bit
This commit is contained in:
parent
58557b9d66
commit
43668425b4
@ -18,7 +18,7 @@
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Runs <%= app %>"
|
||||
NAME=<%= app %>
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
PIDDIR=/var/run/$NAME
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
@ -37,67 +37,35 @@ SCRIPTNAME=/etc/init.d/$NAME
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
### START EACH PROCESS
|
||||
<% engine.procfile.entries.each do |process| %>
|
||||
mkdir -p $PIDDIR
|
||||
# START APPLICATION: <%= app %>
|
||||
<% engine.procfile.entries.each do |process| %>
|
||||
# START PROCESS: <%= process.name %>
|
||||
<% 1.upto(concurrency[process.name]) do |num| %>
|
||||
do_start_<%= process.name %>_<%= num %>()
|
||||
{
|
||||
# This starts the process
|
||||
}
|
||||
# START CONCURRENT: <%= num %>
|
||||
# Code here to start: <%= app %>.<%= process.name %>.<%= num %>
|
||||
# (Create $PIDDIR/<%= process.name %>.<%= num %>.pid)
|
||||
<% end %>
|
||||
<% end %>
|
||||
###
|
||||
<% end %>
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
# Wait for children to finish too if this is a daemon that forks
|
||||
# and if the daemon is only ever run from this initscript.
|
||||
# If the above conditions are not satisfied then add some other code
|
||||
# that waits for the process to drop all resources that could be
|
||||
# needed by services started subsequently. A last resort is to
|
||||
# sleep for some time.
|
||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||
[ "$?" = 2 ] && return 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
### STOP EACH PROCESS
|
||||
<% engine.procfile.entries.each do |process| %>
|
||||
# STOP APPLICATION: <%= app %>
|
||||
<% engine.procfile.entries.each do |process| %>
|
||||
# STOP PROCESS: <%= process.name %>
|
||||
<% 1.upto(concurrency[process.name]) do |num| %>
|
||||
do_stop_<%= process.name %>_<%= num %>()
|
||||
{
|
||||
# This starts the process
|
||||
}
|
||||
# STOP CONCURRENT: <%= num %>
|
||||
# Code here to stop: <%= app %>.<%= process.name %>.<%= num %>
|
||||
# (Kill $PIDDIR/<%= process.name %>.<%= num %>.pid)
|
||||
<% end %>
|
||||
<% end %>
|
||||
###
|
||||
<% end %>
|
||||
rmdir $PIDDIR
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
Binary file not shown.
@ -18,7 +18,7 @@
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Runs app"
|
||||
NAME=app
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
PIDDIR=/var/run/$NAME
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
@ -52,14 +52,14 @@ do_start()
|
||||
}
|
||||
|
||||
### START EACH PROCESS
|
||||
do_start_alpha_1()
|
||||
{
|
||||
do_start_alpha_1()
|
||||
{
|
||||
# This starts the process
|
||||
}
|
||||
do_start_bravo_1()
|
||||
{
|
||||
}
|
||||
do_start_bravo_1()
|
||||
{
|
||||
# This starts the process
|
||||
}
|
||||
}
|
||||
###
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user