Skip to content

Commit 7bb9504

Browse files
kardapoltsevmuuki88
authored andcommitted
Fix systemv logging (#1096)
* Fix logging for SystemV packages The current implementation has no effect; nothing is logged. '>>' seems to be passed to the process as a parameter and not something that is interpretted by the shell. This approach is in line with the accepted solution suggested at https://stackoverflow.com/a/21029952/183863 Fixes #1021 * fixed debian/sysvinit-deb test
1 parent 9e3e660 commit 7bb9504

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/resources/com/typesafe/sbt/packager/archetypes/systemloader/systemv/start-debian-template

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ start_daemon() {
4646
fi
4747

4848
if [ "$create_pidfile" = true ]; then
49-
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
49+
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas /bin/sh --start -- -c "exec $RUN_CMD $RUN_OPTS ${stdout_redirect}"
5050
else
51-
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}
51+
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --pidfile "$PIDFILE" --startas /bin/sh --start -- -c "exec $RUN_CMD $RUN_OPTS ${stdout_redirect}"
5252
fi
5353
log_end_msg $?
5454
}

src/sbt-test/debian/sysvinit-deb/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TaskKey[Unit]("checkStartupScript") := {
4949
)
5050
assert(
5151
script.contains(
52-
"""start-stop-daemon --background --chdir /usr/share/debian-test --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS ${stdout_redirect}"""
52+
"""start-stop-daemon --background --chdir /usr/share/debian-test --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas /bin/sh --start -- -c "exec $RUN_CMD $RUN_OPTS ${stdout_redirect}"""
5353
),
5454
"script has wrong startup line\n" + script
5555
)

0 commit comments

Comments
 (0)