Help: Multiple init scripts pointing to same executable

I can’t figure out how to create multiple init.d scripts that point to the same bin, and stop the correct process.

I would have guessed to use a pid file specified for each script, but I can’t get the script to create a pid file for a given script. I pasted the script below.

I looked at the script for rsyncd and tried to copy everything since I noticed that a pid file is created when its started.

I’m using openSUSE 11.0

Thank you for any help.

#! /bin/sh
#
### BEGIN INIT INFO
# Provides: glusterfsd
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    Start the glusterfsd server daemon
### END INIT INFO

GLUSTERFSD_BIN=/usr/sbin/glusterfsd
test -x $GLUSTERFSD_BIN || exit 5
GLUSTERFSD_PID=/var/run/glusterfsd.pid

. /etc/rc.status

# First reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting glusterfsd daemon"
	startproc -p $GLUSTERFSD_PID -t 2 $GLUSTERFSD_BIN -f /etc/glusterfs/glusterfs-server.vol
	rc_status -v
	;;
    stop)
	echo -n "Shutting down glusterfsd daemon"
	killproc -p $GLUSTERFSD_PID -TERM $GLUSTERFSD_BIN
	rc_status -v
	;;
    restart)
	$0 stop
	$0 start

	rc_status
	;;
    status)
	echo -n "Checking for glusterfsd daemon: "
	checkproc $GLUSTERFSD_BIN
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
	;;
esac
rc_exit

So you want to start multiple instances of the process? In that case you need to create a unique pid file for each instance. You need something to distinguish each instance, perhaps some id that you call the init script with and use this to create the pid filename.

I guess the first question that I’d like answered is why doesn’t my script automatically create a pid file.