|
From: <sa...@pe...> - 2006-09-26 14:49:13
|
Heiko Zuerker wrote on 09/25/2006 09:13:28 PM:
> just a quick answer, since I don't have much time.
> Your best bet is to copy the script /etc/init.d/skeleton and add your
> commands there.
> As you already suspected, add the script with insserv to the boot order.
>
> Of course don't forgett to run a save-config before you reboot. ;-)
Thanks for the reply, Heiko.
It appears that this isn't quite enough to get a service running in DL.
In addition to creating a script based on skeleton (which I called
nfsmount)
and installing it using insserv, I found I also had to add the following
lines to /etc/sysconfig/config
# Mount NFS directories specified in fstab?
START_NFSMOUNT=no
The NFSMOUNT service will then be listed in the Services section of
the setup command. You can then enable it and it will take effect.
I've included the contents of the /etc/init.d/nfsmount file that I
created, in case it can be of use to anyone. Permissions for this file
should be set to -rwx------ as with other service scripts.
---- Cut here: start /etc/init.d/nfsmount ---------------------------
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: NFS mounting
# Required-Start: $network $syslog $named portmap
# Required-Stop: $network $syslog $named portmap
# Default-Start: 3 5
# Default-Stop: 6 0
# Description: Mount NFS entries in /etc/fstab
### END INIT INFO
# settings
source /etc/sysconfig/config
# parameters
NAME="NFS directories"
CONFIGNAME=NFSMOUNT
MOUNT_PROG=/bin/mount
UMOUNT_PROG=/bin/umount
PARAMETER="-a -t nfs"
# source function library
source /etc/init.d/functions
eval START=\$START_$CONFIGNAME
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# Force execution if not called by a runlevel directory.
test $link = $base && START=yes
test "$START" = "yes" || exit 0
case "$1" in
start)
echo -n "Mounting $NAME: "
$MOUNT_PROG $PARAMETER
evaluate_retval
;;
stop)
echo -n "Unmounting $NAME: "
$UMOUNT_PROG $PARAMETER
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
---- Cut here: end /etc/init.d/nfsmount ----------------------------
--
Scott A. |