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

Adjust mixed indenting in start-debian-template. #983

Merged
merged 1 commit into from
May 25, 2017
Merged
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 @@ -22,51 +22,48 @@ export JAVA_OPTS
# 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
create_pidfile=true
PIDFILE=/var/run/${{app_name}}/running.pid
fi

if [ -z "$DAEMON_USER" ]; then
DAEMON_USER=${{daemon_user}}
DAEMON_USER=${{daemon_user}}
fi

if [ -z "$DAEMON_GROUP" ]; then
DAEMON_GROUP=${{daemon_group}}
DAEMON_GROUP=${{daemon_group}}
fi


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}}"
logfile="${{daemon_log_file}}"
stdout_redirect=""
if [ ! -z "${logfile:-}" ]; then
stdout_redirect=" >> ${{logdir}}/${{app_name}}/$logfile 2>&1"
fi

if [ "$create_pidfile" = true ]; then
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
else
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
fi
log_end_msg $?
log_daemon_msg "Starting" "${{app_name}}"
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/${{app_name}}"
logfile="${{daemon_log_file}}"
stdout_redirect=""
if [ ! -z "${logfile:-}" ]; then
stdout_redirect=" >> ${{logdir}}/${{app_name}}/$logfile 2>&1"
fi

if [ "$create_pidfile" = true ]; then
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
else
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
fi
log_end_msg $?
}


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 $?
if [ "$create_pidfile" = true ]; then
rm -f "$PIDFILE"
fi
log_daemon_msg "Stopping" "${{app_name}}"
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE" --retry=TERM/${{term_timeout}}/KILL/${{kill_timeout}}
log_end_msg $?
if [ "$create_pidfile" = true ]; then
rm -f "$PIDFILE"
fi
}

case "$1" in

start)
start_daemon
exit $?
Expand Down