#!/bin/bash
# Sabnzbd Process Monitor
# Restart Sabnzbd When It Goes Down
# ----------------------------------------------------------
# This script requires you have setup sab as a init.d
# daemon -
http://wiki.sabnzbd.org/install-as-a-unix-daemon
# ----------------------------------------------------------
STOP="/etc/init.d/sabnzbd stop"
START="/etc/init.d/sabnzbd start"
#path to pgrep command (including the -f argument required)
PGREP="/usr/bin/pgrep -f"
# Sab daemon name,
SABPROC="SABnzbd"
# find pid
$PGREP ${SABPROC}
if [ $? -ne 0 ] # if not running
then
# restart
$STOP
$START
fi