creating a sysv script

Scot L. Harris webid at cfl.rr.com
Thu Jan 27 21:09:18 UTC 2005


On Thu, 2005-01-27 at 12:13, Craig White wrote:
> ----
> that's exactly what I'm trying to do - when I launch it as it is now
> (from within /etc/rc.d/init.d/relay) and I chkconfig and service start
> stuff...it still is controlled by a terminal
> 
> #ps aux|grep relaydelay
> root     28682  0.0  1.2 38960 6404 pts/3    S    07:50
> 0:00 /usr/bin/perl -w /root/relaydelay-0.04/relaydelay.pl
> 
> note -> pts/3 
> 
> If I close that terminal, program stops.
> 
> I would love to see what you get from ps aux command...
> 
> If your launch is detached from a terminal (i.e. a ? instead of pts/3 or
> some other) then I would love to see your sysV script. I know that at
> the beginning of the thread, I included mine.
> 
> Craig


Try this.


$ ps -eaf |grep grey 
smmsp    27841     1  0 Jan19 ?        00:00:00
/usr/local/bin/milter-greylist -





-- 
Scot L. Harris
webid at cfl.rr.com

The grass is always greener on the other side of your sunglasses. 
#!/bin/sh
# $Id: rc-linux.sh.in,v 1.1 2004/04/03 09:26:11 manu Exp $
#  init file for milter-greylist
#
# chkconfig: - 50 50
# description: Milter Greylist Daemon
#
# processname: /usr/local/bin/milter-greylist
# config: /etc/mail/greylist.conf
# pidfile: /var/run/milter-greylist.pid

# source function library
. /etc/init.d/functions

pidfile="/var/run/milter-greylist.pid"
socket="/var/milter-greylist/milter-greylist.sock"
user="smmsp"
OPTIONS="-P $pidfile -u $user -p $socket"
RETVAL=0
prog="Milter-Greylist"

start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                daemon /usr/local/bin/milter-greylist $OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter-greylist
        fi;
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                killproc /usr/local/bin/milter-greylist
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/milter-greylist
        fi;
        echo
        return $RETVAL
}


restart(){
        stop
        start
}

condrestart(){
    [ -e /var/lock/subsys/milter-greylist ] && restart
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        condrestart
        ;;
  status)
        status milter-greylist
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
        RETVAL=1
esac

exit $RETVAL





More information about the fedora-list mailing list