[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AG-TECH] How to automatically start Venue Server on Fedora Core4



Hey Sebastian,

I've attached my hacked together init.d script for starting the venue server on a RHEL box.

Note: the daemonAG() function in the script was stolen the daemon() function in /etc/init.d/functions. It is verbatim except for the actual line that launches the program, which I changed to this:

su -s /bin/bash - $user -c "$* &" >/dev/null 2>&1

which launches the VenueServer process in a shell of a defined user.

As you'll see in the start() function in the script, I run under a user called 'ag' - you can change that to whatever you need.

This script was kinda just thrown together with bits from other init scripts, so I'm sure it could be pared down a bit - but it has worked for me for a couple of years now.


Todd











Sebastian Tabarce wrote:
Hi!

Has any of you guys tried to automatically start at boot the Venue Server on Fedora Core 4 (or any other OS)?
I've tried, but with no success.
First I added this line to rc.local:
/usr/bin/VenueServer.py
but Fedora was stuck on start-up after starting the server.
After modifying it to:
/usr/bin/VenueServer.py &
to send the process in background, Fedora starts ok, the server starts and I can see it in the process list, but any client trying to connect to it from the same machine or any other just hangs for ever.
What am I doing wrong? Suggestions are welcomed, I'm familliar with linux but not a linux expert.....
Thanks!
Sebastian

#!/bin/sh
#
# venueServer	Takes care of starting and stopping the 
#		VenueServer
#
# chkconfig: - 50 50
# description: AG VenueServer

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/bin/VenueServer.py ] || exit 



# A function to start a program.
daemonAG() {
	# Test syntax.
	local gotbase= force=
	local base= user= nice= bg= pid=
	nicelevel=0
	while [ "$1" != "${1##[-+]}" ]; do
	  case $1 in
	    '')    echo $"$0: Usage: daemonAG [+/-nicelevel] {program}"
	           return 1;;
	    --check)
		   base=$2
		   gotbase="yes"
		   shift 2
		   ;;
	    --check=?*)
	    	   base=${1#--check=}
		   gotbase="yes"
		   shift
		   ;;
	    --user)
		   user=$2
		   shift 2
		   ;;
	    --user=?*)
	           user=${1#--user=}
		   shift
		   ;;
	    --force)
	    	   force="force"
		   shift
		   ;;
	    [-+][0-9]*)
	    	   nice="nice -n $1"
	           shift
		   ;;
	    *)     echo $"$0: Usage: daemonAG [+/-nicelevel] {program}"
	           return 1;;
	  esac
	done

        # Save basename.
        [ -z "$gotbase" ] && base=${1##*/}


	# make sure it doesn't core dump anywhere; while this could mask
	# problems with the daemon, it also closes some security problems
	ulimit -S -c 0 >/dev/null 2>&1
	
	# if they set NICELEVEL in /etc/sysconfig/foo, honor it
	[ -n "$NICELEVEL" ] && nice="nice -n $NICELEVEL"
	
	# Echo daemon
        [ "${BOOTUP:-}" = "verbose" -a -z "$LSB" ] && echo -n " $base"

	su -s /bin/bash - $user -c "$* &" >/dev/null 2>&1
	
	[ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
}









RETVAL=0
prog="VenueServer"

start() {
    # Start daemons.
    echo -n $"Starting $prog: "
    daemonAG --user ag VenueServer.py  
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/agVenueServer
    return $RETVAL
}

stop() {
    # Stop daemons.
    echo -n $"Shutting down $prog: "
    killproc VenueServer.py
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/agVenueServer
    return $RETVAL
}

# See how we were called.
case "$1" in
    start)
	start
        ;;
    stop)
	stop
        ;;
    status)
	status agVenueServer
	RETVAL=$?
	;;
    restart|reload)
	stop
	start
	RETVAL=$?
	;;
    condrestart)
	if [ -f /var/lock/subsys/agVenueServer ]; then
	    stop
	    start
	    RETVAL=$?
	fi
	;;
    *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac

exit $RETVAL