Full list of functions is much longer and most possibilities (like way to control whether or not non-root users can launch daemon) are still undocumented and can be learned only from {{ic|/etc/rc.d/functions}} source. See also {{Ic|man rc.d}}.

−

ARGS=

−

[ -r /etc/conf.d/$DAEMON.conf ] && . /etc/conf.d/$DAEMON.conf

+

== Example ==

−

+

The following is an example for ''crond''. Look in {{ic|/etc/rc.d}} for greater variety.

−

PID=$(pidof -o %PPID $DAEMON)

−

−

case "$1" in

−

start)

−

stat_busy "Starting $DAEMON daemon"

−

[ -z "$PID" ] && $DAEMON $ARGS &>/dev/null

−

if [ $? = 0 ]; then

−

add_daemon $DAEMON

−

stat_done

−

else

−

stat_fail

−

exit 1

−

fi

−

;;

−

stop)

−

stat_busy "Stopping $DAEMON daemon"

−

[ -n "$PID" ] && kill $PID &>/dev/null

−

if [ $? = 0 ]; then

−

rm_daemon $DAEMON

−

stat_done

−

else

−

stat_fail

−

exit 1

−

fi

−

;;

−

restart)

−

$0 stop

−

sleep 1

−

$0 start

−

;;

−

status)

−

stat_busy "Checking $DAEMON status"

−

ck_status $DAEMON

−

;;

−

*)

−

echo "usage: $0 {start|stop|restart|status}"

−

esac

−

</pre>

−

−

==Example==

−

The following is an example for ''tftpd''. Look in {{Filename|/etc/rc.d}} for a greater variety.

[add|rm]_daemon program: add/remove program to running daemons (stored in /run/daemons/)

Full list of functions is much longer and most possibilities (like way to control whether or not non-root users can launch daemon) are still undocumented and can be learned only from /etc/rc.d/functions source. See also man rc.d.

Example

The following is an example for crond. Look in /etc/rc.d for greater variety.