initd


Hits :

3,485

Init.d Scripts



proftpd


Πολλές φορές χρειάζομαι ένα script για να κάνω start / stop ένα custom program:


A very simple script to start / stop a server


/etc/init.d/proftpd


BASH
#!/bin/sh
# description: Start/stop Proftpd
# chkconfig: 235 99 99

# ebal 30/01/2008

server="Proftpd Ftp Server "
pidfile="/var/run/proftpd.pid"
daemon='/usr/local/sbin/proftpd'

if [ $USER = "root" ]; then

if [ -f $pidfile ]; then
        status=1
else
        status=0
fi

case "$1" in
'start')
        if [ 1 -eq $status ]; then
                $0 status
        else
                echo "Starting "$server "..."
                $daemon
                sleep 1
                $0 status
        fi
        ;;
'stop')
        if [ 1 -eq $status ]; then
                echo "Stoping "$server "..."
                kill -15 `cat $pidfile`
                sleep 1
                rm -f $pidfile
                $0 status
        else
                $0 status
        fi
        ;;
'status')
        if [ 1 -eq $status ]; then
                echo $server "is runnning with pid: `cat $pidfile`"
        else
                echo $server "is NOT running";
        fi
        echo
        ;;
'restart')
        $0 stop
        $0 start
        ;;
        *)
        echo -n "Usage: $0 {start|stop|restart|status)";
                echo "";
        exit 1
esac

else
        echo "You are not allowed to run this program"
fi

top


knockd


knock


top


Dovecot


top



Ziproxy


top


ClamSMTP


http://thewalter.net/stef/software/clamsmtp/


top