#!/bin/bash # # Copyright (c) 2007-2009 ZeroC, Inc. All rights reserved. # # icegridnode This shell script takes care of starting and # stopping the icegridnode daemon. # ### BEGIN INIT INFO # Provides: icegridnode # Required-Start: $network icegridregistry # Required-Stop: $network icegridregistry # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Start the IceGrid node daemon. # Description: The IceGrid node daemon. # IceGrid is the server deployment and monitoring for the Internet # Communications Engine (Ice). An IceGrid domain consists of one master # registry, zero or more slave registries, and zero or more IceGrid nodes. ### END INIT INFO # # Source function library. # . /etc/init.d/functions # # The IceGrid node user; root is allowed, but not necessary, therefore # it is recommended to use a non-root account. # user=iceuser # # Ask for a password at startup? # prompt=no # # The IceGrid node configuration file # nodeconf="/etc/icegridnode.conf" prog="/usr/bin/icegridnode" progbase=${prog##*/} pidfile=/var/run/$progbase.pid options="--daemon --pidfile $pidfile --Ice.Config=$nodeconf" RETVAL=0 start() { if [ "${prompt:-}" = "yes" ] then gprintf "Starting %s: \n" "$progbase" INITLOG_ARGS= # clears -q else gprintf "Starting %s: " "$progbase" fi if [ "$user" != "root" ] then daemonoptions="--user $user" if [ ! -e $pidfile ] then touch $pidfile fi chown $user $pidfile fi daemon $daemonoptions $prog $options RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$progbase return $RETVAL } stop() { gprintf "Shutting down %s: " "$progbase" killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$progbase return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $progbase RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/$progbase ]; then stop start RETVAL=$? fi ;; *) gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$0" exit 1 esac exit $RETVAL