Hello,
I run a perl daemon as spam filter. When a update from the main perlsript is available,
it was download, extract und then the mainscript makes a "exit 1" (I think it is like an errorlevel in DOS) to restart.In the start-shell i must look with what exit the script ends und if is an exit 1 than make a restart, if it was an exit 0 than end the daemon.
In the moment I must control the status of the daemon every day and when he doesn´t run I
must start the daemon manualy.
My question is, how must I make, that the perl-scipt starts automatic ?
I have make some tests, but I didn´t find the right way.
best regards
Ralf
Here is my Start-script :
I run a perl daemon as spam filter. When a update from the main perlsript is available,
it was download, extract und then the mainscript makes a "exit 1" (I think it is like an errorlevel in DOS) to restart.In the start-shell i must look with what exit the script ends und if is an exit 1 than make a restart, if it was an exit 0 than end the daemon.
In the moment I must control the status of the daemon every day and when he doesn´t run I
must start the daemon manualy.
My question is, how must I make, that the perl-scipt starts automatic ?
I have make some tests, but I didn´t find the right way.
best regards
Ralf
Here is my Start-script :
Code:
#!/bin/sh
#
# $FreeBSD: ports/mail/assp/files/assp.in,v 1.1 2006/07/18 03:08:23 rafan Exp $
#
# PROVIDE: assp
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=assp2
rcvar=`set_rcvar`
start_cmd=assp_start
stop_cmd=assp_stop
restart_cmd=assp_restart
# command=/var/db/assp2/assp.pl
# command_interpreter=/usr/bin/perl
pidfile=/var/db/assp2/pid
extra_commands="reload"
reload_cmd=assp_reload
assp_start()
{
if [ "$1" = "" ]
then
BASE=/var/db/assp2;
else
BASE=$1;
fi
export BASE
echo Starting ASSP Anti-SPAM Proxy server in $BASE
trap '' 1
LANG=
export LANG
exec $BASE/assp.pl $BASE
RETVAL=$?
exit $RETVAL
}
assp_stop()
{
if [ "$1" = "" ]
then
BASE=/var/db/assp2;
else
BASE=$1;
fi
export BASE
echo Stopping ASSP Anti-SPAM Proxy server in $BASE
pidfile=$BASE/pid
kill `cat $pidfile`
rm -f $pidfile
}
load_rc_config $name
: ${assp2_enable="NO"}
: ${assp2_flags="/var/db/assp2"}
assp_reload()
{
kill -USR1 `cat $pidfile`
}
assp_restart()
{
/var/db/assp2/stop && /var/db/assp2/start
}
run_rc_command "$1"