#!/bin/sh
# $Id: launch.sh,v 1.3 2001/01/21 23:59:42 holsta Exp $
# This script launches dancer unless it's already running.
# You can put it in a crontab. This checks each half hour
# 0,30 * * * * /home/user/bot/launch.sh
# In order to make your bot run from a special IP number of your multiple IP
# host, make the DANCER_MYHOST below contain the *IP* address of your choice.
#export DANCER_MYHOST=x.x.x.x
# If "." is not in your path (it shouldn't really be), you may want to add the
# Dancer install directory to your path, when this script is run.
export PATH=/home/user/bot;$PATH;
# The dancer install directory
path="/home/user/bot"
# The name of the executable
prog="dancer"
# The PID file
pidfile="$path/.pid"
# The logfile for this script
logfile="/dev/null"
if [ -f $pidfile ]; then
pid=`cat $pidfile`
kill -0 $pid > $logfile 2>&1 || (cd $path;$prog > $logfile 2>&1 &)
else
(cd $path;$prog > $logfile 2>&1 &)
fi
syntax highlighted by Code2HTML, v. 0.9.1