Skip to content

Commit a212200

Browse files
committed
Merge pull request #382 from ArtemPyanykh/fix-varrun-permissions
Fix permissions and group for /var/run/${{app_name}} folder in SystemV init script
2 parents 1f4222e + 3029508 commit a212200

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ if [ -z "$DAEMON_USER" ]; then
1919
DAEMON_USER=${{daemon_user}}
2020
fi
2121

22+
if [ -z "$DAEMON_GROUP" ]; then
23+
DAEMON_GROUP=${{daemon_group}}
24+
fi
25+
2226

2327
RUN_CMD="${{chdir}}/bin/${{exec}}"
2428

2529

2630
start_daemon() {
2731
log_daemon_msg "Starting" "${{app_name}}"
28-
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -m750 "/var/run/${{app_name}}"
32+
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/${{app_name}}"
2933
start-stop-daemon --background --chdir ${{chdir}} --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --exec "$RUN_CMD" --start -- $RUN_OPTS
3034
log_end_msg $?
3135
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ if [ -z "$DAEMON_USER" ]; then
3838
DAEMON_USER=${{daemon_user}}
3939
fi
4040

41+
if [ -z "$DAEMON_GROUP" ]; then
42+
DAEMON_GROUP=${{daemon_group}}
43+
fi
44+
4145

4246
# smb could define some additional options in $RUN_OPTS
4347
RUN_CMD="${{chdir}}/bin/${{app_name}}"
@@ -64,7 +68,7 @@ start() {
6468
[ $retval -eq 0 ] && touch ${lockfile} && success || failure
6569

6670
# Insert pid into pid file for CentOS killproc function
67-
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -m750 "/var/run/${{app_name}}"
71+
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/${{app_name}}"
6872
echo
6973
echo $PID > ${PIDFILE}
7074
return $retval

0 commit comments

Comments
 (0)