[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] Init Scripts
From:       "James Yonan" <jim () yonan ! net>
Date:       2003-06-28 16:11:48
[Download RAW message or body]


Hi,

I'm new to Gentoo and I'm trying to convert the RedHat init script for OpenVPN
over to Gentoo's format.  Though I'm still learning the Gentoo way of writing
init scripts, I would like to suggest the following additions to runscript.sh:

(1) There should be an easy-to-call support function so an init script can
tell whether or not it has been started such as:

started() {
    if [ -L "${svcdir}/started/${myservice}" ]; then
        return 1
    else
        return 0
    fi
}

This way, init scripts can easily tell if they are loaded, prior to doing
things like sending signals to daemons.

(2) Condrestart is a useful init script method, often seen in RH init scripts.
   It basically says "restart only if service is already running".  It is
commonly used to restart a daemon after a software update.  OpenVPN needs it
so that the VPN daemon can be restarted if a network adaptor gets a new IP
address from a DHCP server.  In cases like these, you obviously don't want to
restart the daemon unless it is already running.  Condrestart becomes
breathtakingly simple if started() above is defined:

condrestart() {
    started || restart
}

If there are better ways of doing these things in Gentoo, please let me know.
 Otherwise, I can send a formal patch of my changes to runscript.sh

Thanks,

James Yonan


--
gentoo-dev@gentoo.org mailing list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic