Remove underscore from usernames

Cleanup init scripts, use $USERNAME and $HOMDIR variables
This commit is contained in:
badaix 2019-11-20 22:25:41 +01:00
parent 5a68f95828
commit 09bd4c3bf7
8 changed files with 19 additions and 17 deletions

View file

@ -16,6 +16,7 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Snapcast client"
NAME=snapclient
USERNAME=snapclient
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME/pid
SCRIPTNAME=/etc/init.d/$NAME
@ -47,15 +48,15 @@ do_start()
PIDDIR=$(dirname "$PIDFILE")
if [ ! -d "$PIDDIR" ]; then
mkdir -m 0755 $PIDDIR
chown _snapclient:_snapclient $PIDDIR
chown $USERNAME:$USERNAME $PIDDIR
fi
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" --test > /dev/null || return 1
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" -- $SNAPCLIENT_OPTS > /dev/null || return 2
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" --test > /dev/null || return 1
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" -- $SNAPCLIENT_OPTS > /dev/null || return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.