All pastes #803903 Raw Edit

Unnamed

public text v1 · immutable
#803903 ·published 2007-12-02 19:19 UTC
rendered paste body
#!/bin/sh

# Crontab script for Anope

# Anope binary directory
ANOPATH=/home/ircd/services/daemon/

# Name of the pid file
ANOPIDF=services.pid

# Name of the executable
ANOPROG=services

PATH=/bin:/usr/bin:/usr/local/bin

ANOPID=

cd $ANOPATH
if [ -f $ANOPIDF ]
then
# If pid file is found
        ANOPID=`cat $ANOPIDF`
        if [ `ps auwx | grep $ANOPROG | grep $ANOPID | grep -v -c grep` = 1 ]
        then
                # services.pid is found and is running...
                # exit silently ;-)
                exit
        fi
        # If pid exists, but isn't found running...
        echo "Anope Crontab notice:"
        echo ""
        echo "Stale $ANOPIDF file (erasing it)."
        echo ""
        # remove it
        rm -f $ANOPIDF
fi
# If the pid file isn't found...start anope...
echo "Anope Crontab notice:"
echo ""
echo "Couldn't find the services running. Reloading it..."
echo ""
./$ANOPROG