monitoring/OLD/check_cups.sh

23 lines
524 B
Bash
Executable File

#!/usr/bin/env bash
## - Check if cups service is runnning. If service is down
## - start it.
## -
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if ! ps ax | grep /usr/sbin/cupsd | grep -v grep > /dev/null ; then
echo -e "\n\tCups Daemon is not running. So i'm going to (re)start the cups service..\n"
/etc/init.d/cups stop
kill -9 `cat /var/run/cups/cupsd.pid 2>/dev/null` > /dev/null 2>&1
rm -f /var/run/cups/cupsd.pid
## - Start cups daemon
/etc/init.d/cups start
fi
exit 0