Results 1 to 3 of 3

Thread: Help: Multiple init scripts pointing to same executable

  1. #1
    drewkett NNTP User

    Default 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.
    Code:
    #! /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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: Help: Multiple init scripts pointing to same executable

    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.

  3. #3
    drewkett NNTP User

    Default Re: Help: Multiple init scripts pointing to same executable

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •