Updated: 22 October 2026 · Applies to: DirectAdmin, any service not covered by DirectAdmin's own service monitor
DirectAdmin's built-in service monitor checks only the services it knows about. For anything else you run (this example checks spamd), a small shell script plus a cron job does the same job: check the process, restart it if missing, and email you if the restart did not work.
#!/bin/sh
COUNT=`ps -ax | grep -v grep | grep -c spamd`
if [ $COUNT -eq 0 ]; then
# the command used to start spamd
/usr/bin/spamd -d -c -m 5
sleep 3
COUNT=`ps -ax | grep -v grep | grep -c spamd`
if [ $COUNT -eq 0 ]; then
echo -e "Subject: spamd is down\n\nspamd is down.\n\n" | /usr/sbin/exim your@email.com
fi
fi
exit 0
Replace spamd and its start command with whatever process and start command you need to monitor, and the email address with your own.
Save this as a script file, make it executable, and add a root cron job to run it regularly:
chmod 755 check-spamd.sh
DirectAdmin's own service monitor checks every minute; this script does not track whether it already sent an email the previous run, so running it that often will send one email per minute while the service stays down. Every 5 or 10 minutes is usually enough to be notified without flooding your inbox.