Stop creating /var/lock/subsys and polluting it with a MailScanner lockfile that no-one's using. Do not consider a missing PID file a reason for restarting the daemon. Most likely it's just been installed and never been started or stopped (so MailScanner.off doesn't exist). Drop the check whether MailScanner is configured. Our start script is not using it (if it's enabled, it's enabled) and ms-check will still only do anything if the pidfile exists but no process named MailScanner with that pid exists and the stopped_lockfile doesn't exist. This should be safe enough. --- MailScanner-5.0.3-7/usr/sbin/ms-check.orig 2016-11-13 19:29:34.000000000 +0100 +++ MailScanner-5.0.3-7/usr/sbin/ms-check 2016-11-13 19:29:47.000000000 +0100 @@ -30,7 +30,6 @@ NAME=MailScanner DAEMON=/usr/sbin/MailScanner QUICKPEEK=/usr/sbin/ms-peek -run_mailscanner=0 ramdisk_sync=0 ms_conf=/etc/MailScanner/MailScanner.conf ms_core=/usr/share/MailScanner @@ -60,15 +59,8 @@ # Exit if the MailScanner executable is not installed [ -x $DAEMON ] || exit 0 -# if /var/lock/subsys is missing -[ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys - -# Don't start if MailScanner is not configured -if [ $run_mailscanner = 0 ]; then - exit 0 -fi - # check if a PID file exists +RETVAL=0 if [ -f $PIDFILE ] ; then # get the PID PID=$(head -n 1 $PIDFILE) @@ -77,9 +69,6 @@ # get the return RETVAL="$?" - -else - RETVAL=9 fi # if 0 it is already running @@ -109,11 +98,6 @@ # start mailscanner $DAEMON $ms_conf - # set run file - if [ ! -f /var/lock/subsys/MailScanner ] ; then - touch /var/lock/subsys/MailScanner - fi - exit 0 fi