Skip to content

Commit

Permalink
Merge pull request #382 from ArtemPyanykh/fix-varrun-permissions
Browse files Browse the repository at this point in the history
Fix permissions and group for /var/run/${{app_name}} folder in SystemV init script
  • Loading branch information
kardapoltsev committed Oct 20, 2014
2 parents 1f4222e + 3029508 commit a212200
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ if [ -z "$DAEMON_USER" ]; then
DAEMON_USER=${{daemon_user}}
fi

if [ -z "$DAEMON_GROUP" ]; then
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" -m750 "/var/run/${{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" --exec "$RUN_CMD" --start -- $RUN_OPTS
log_end_msg $?
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ if [ -z "$DAEMON_USER" ]; then
DAEMON_USER=${{daemon_user}}
fi

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


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

# Insert pid into pid file for CentOS killproc function
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -m750 "/var/run/${{app_name}}"
[ -d "/var/run/${{app_name}}" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/${{app_name}}"
echo
echo $PID > ${PIDFILE}
return $retval
Expand Down

0 comments on commit a212200

Please sign in to comment.