#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
##  rc.proftpd -- Run-Commands for ProFTPD
##

%config
    proftpd_enable="yes"

%start -p 200 -u root
    if opServiceEnabled proftpd; then
        @l_prefix@/sbin/proftpd
    fi

%stop -p 200 -u root
    if opServiceEnabled proftpd; then
        if [ -f @l_prefix@/var/proftpd/proftpd.pid ]; then
            kill -TERM `cat @l_prefix@/var/proftpd/proftpd.pid`
        fi
    fi

%restart -u root
    if opServiceEnabled proftpd; then
        if [ -f @l_prefix@/var/proftpd/proftpd.pid ]; then
            kill -TERM `cat @l_prefix@/var/proftpd/proftpd.pid`
            sleep 2
        fi
        @l_prefix@/sbin/proftpd
    fi

%reload -u root
    if opServiceEnabled proftpd; then
        if [ -f @l_prefix@/var/proftpd/proftpd.pid ]; then
            kill -HUP `cat @l_prefix@/var/proftpd/proftpd.pid`
        fi
    fi

