diff --git a/packaging/files/chirpstack-gateway-bridge.init b/packaging/files/chirpstack-gateway-bridge.init index 7d1b8fcc..2d3e9d97 100644 --- a/packaging/files/chirpstack-gateway-bridge.init +++ b/packaging/files/chirpstack-gateway-bridge.init @@ -41,7 +41,7 @@ function do_start { } function do_stop { - start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile "$PID_FILE" --name "$NAME" + start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile "$PID_FILE" --exec "$DAEMON" retval="$?" sleep 1 return "$retval" diff --git a/packaging/scripts/post-install.sh b/packaging/scripts/post-install.sh index 3a43bddf..12113af0 100755 --- a/packaging/scripts/post-install.sh +++ b/packaging/scripts/post-install.sh @@ -32,14 +32,20 @@ function restart_service { fi } +function create_logdir { + if [[ ! -d $LOG_DIR ]]; then + mkdir -p $LOG_DIR + chown -R $DAEMON_USER:$DAEMON_GROUP $LOG_DIR + fi +} + # create user id $DAEMON_USER &>/dev/null if [[ $? -ne 0 ]]; then useradd --system -U -M $DAEMON_USER -s /bin/false -d /etc/$NAME fi -mkdir -p "$LOG_DIR" -chown $DAEMON_USER:$DAEMON_GROUP "$LOG_DIR" +create_logdir # set the configuration owner / permissions if [[ -f /etc/$NAME/$NAME.toml ]]; then