Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SystemV init script template for debian packaging #697

Merged
merged 2 commits into from
Nov 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ##### Environment Configuration #####
# #####################################

# This file gets sourced before the actual bashscript
# This file gets sourced before the actual startscript
# gets executed. You can use this file to provide
# environment variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
source /lib/init/vars.sh
source /lib/lsb/init-functions

# adding bashScriptEnvConfigLocation
# Source from package defined config. Defaults to,
# bashScriptEnvConfigLocation := Some("/etc/default/" + (packageName in Linux).value)
[[ -f ${{env_config}} ]] && . ${{env_config}}

# $JAVA_OPTS used in $RUN_CMD wrapper
export JAVA_OPTS

PIDFILE=/var/run/${{app_name}}/running.pid
# If program manages its own PID file then it
# should declare its location in PIDFILE
if [ -z "$PIDFILE" ]; then
create_pidfile=true
PIDFILE=/var/run/${{app_name}}/running.pid
fi

if [ -z "$DAEMON_USER" ]; then
DAEMON_USER=${{daemon_user}}
Expand All @@ -35,7 +41,11 @@ RUN_CMD="${{chdir}}/bin/${{exec}}"
start_daemon() {
log_daemon_msg "Starting" "${{app_name}}"
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/${{app_name}}"
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS
if [ "$create_pidfile" = true ]; then
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS
else
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS
fi
log_end_msg $?
}

Expand All @@ -44,7 +54,9 @@ stop_daemon() {
log_daemon_msg "Stopping" "${{app_name}}"
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE" --retry=TERM/${{term_timeout}}/KILL/${{kill_timeout}}
log_end_msg $?
rm -f "$PIDFILE"
if [ "$create_pidfile" = true ]; then
rm -f "$PIDFILE"
fi
}

case "$1" in
Expand Down
6 changes: 3 additions & 3 deletions src/sphinx/topics/play.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ One way to provide this information is to append the following content in your b
This way you should either store your production configuration under ``${{path_to_app_name}}/conf/production.conf``
or put it under ``/usr/share/${{app_name}}/conf/production.conf`` by hand or using some configuration management system.

RPM and SystemV
~~~~~~~~~~~~~~~
SystemV
~~~~~~~

If you use a system with rpm as a packaging managing system (Fedora, CentOS, RedHat,...) make sure to provide
If you use a system using SystemV start script make sure to provide
a `etc-default` in `src/templates` and set the `PIDFILE` environment variable.


Expand Down