This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
lsts_glued/rules/omniorb/fs/etc/rc.d/omninames

58 lines
1.1 KiB
Plaintext
Raw Normal View History

2013-07-13 17:19:22 +01:00
# Program options
NAME=omniNames
DAEMON=/usr/bin/omniNames
OMNINAMES_DIR=/var/omninames
test -f $DAEMON || exit 5
start()
{
# Make sure directories exist (NEED AN RW FS!)
if [ ! -d $OMNINAMES_DIR ]; then
mkdir -p $OMNINAMES_DIR
fi
pid=$(pidof ${NAME})
if [ ! -z "$pid" ]; then
echo " Impossible: already running (pid $(pidof ${NAME}))"
else
OMNINAMES_OPTIONS="-errlog $OMNINAMES_DIR/error.log -logdir $OMNINAMES_DIR"
# First time?
if [ ! -f $OMNINAMES_DIR/omninames-*.log ]; then
OMNINAMES_OPTIONS="$OMNINAMES_OPTIONS -start $TCPPORT"
fi
# Run it
$DAEMON $OMNINAMES_OPTIONS &> /dev/null &
# Sleep a while, and then check if omniNames is still running
sleep 2
if [ ! -z "`pidof ${NAME}`" ]; then
echo " Starting ${NAME} (PID=$(pidof ${NAME})) [OK]"
else
echo " Starting ${NAME} [KO]"
fi
fi
}
stop()
{
pid=$(pidof ${NAME})
if [ -z "${pid}" ]; then
echo " Impossible: process ${NAME} is not running..."
else
echo -n " Stopping ${NAME}... "
kill ${pid}
while [ -n "`pidof ${NAME}`" ]; do
sleep 1
done
echo " Done! "
fi
}