X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=debian%2Fspamass-milter.init;h=4855d4eec76efebbdaa4cee5541a802f05323523;hb=f1e8e76b711db827f304c1b2ad0defee10ed9417;hp=d6296d53c9c3b4b9527c0876217dcb19cf9131d8;hpb=cf66a1f3dea7a9dcd2700694157c74c7e056dd48;p=deb_pkgs%2Fspamass-milter.git diff --git a/debian/spamass-milter.init b/debian/spamass-milter.init index d6296d5..4855d4e 100644 --- a/debian/spamass-milter.init +++ b/debian/spamass-milter.init @@ -75,19 +75,21 @@ fi; set -e start() { - if [ ! -d $(dirname $SOCKET) ]; then - mkdir -p $(dirname $SOCKET); - if [ -n "$SOCKETOWNER" ]; then - chown "$SOCKETOWNER" $(dirname $SOCKET); - fi; - fi; + # Because the default socket is in the same location as the + # pidfile, we create them in this order. if [ ! -d $(dirname $PIDFILE) ]; then mkdir -p $(dirname $PIDFILE); if [ -d $(dirname $PIDFILE) ] && [ -n "$RUNAS" ]; then chown "$RUNAS" $(dirname $PIDFILE); fi; fi; - if [ -n "$RUNAS" ] && [ -d $(dirname $PIDFILE) ] && [ "$(stat -c '%U' $(dirname $PIDFILE))" = "$RUNAS" ]; then + if [ ! -d $(dirname $SOCKET) ]; then + mkdir -p $(dirname $SOCKET); + if [ -n "$SOCKETOWNER" ]; then + chown "$SOCKETOWNER" $(dirname $SOCKET); + fi; + fi; + if [ -n "$RUNAS" ] && [ -d $(dirname $PIDFILE) ] && [ "$(stat -c '%U' $(dirname $PIDFILE))" != "$RUNAS" ]; then echo "WARNING: $NAME will run as user $RUNAS but $(dirname $PIDFILE) is not owned by $RUNAS"; echo "Either delete this directory or chown it appropriately. Startup attempts may fail."; fi;