Gentoo Archives: gentoo-dev

From: James Yonan <jim@×××××.net>
To: gentoo-dev@g.o
Subject: [gentoo-dev] Init Scripts
Date: Sat, 28 Jun 2003 16:11:50

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

(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
        return 0

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


James Yonan

gentoo-dev@g.o mailing list


Subject Author
Re: [gentoo-dev] Init Scripts Marko Mikulicic <marko@××××.org>
Re: [gentoo-dev] Init Scripts Martin Schlemmer <azarah@g.o>