Commit db777daa authored by Lorenzo Pivetta's avatar Lorenzo Pivetta

Initial import

parent b7b93c98
This diff is collapsed.
#!/bin/bash
#
# WARNING! WARNING! WARNING!
#
# Do **NOT** edit this file! Your changes will be overwritten!
HOSTNAME=`hostname`
CONFFILE=/runtime/site/${HOSTNAME}/etc/starter.conf
SRV="Starter"
INSTANCE=${HOSTNAME}
LOGFILE=/runtime/site/${HOSTNAME}/log/${SRV}-stdout-stderr.log
ROOT=0
MYSELF=`basename $0`
# workaround for ORBendPoint as env var
IP=`host ${HOSTNAME} | awk '{print $4}'`
export ORBendPoint=giop:tcp:${IP}:
# defaults
export PATH=/bin:/sbin:/usr/sbin:/usr/bin
startsrv()
{
pid=`ps -ef|awk '$8 == search1 && $9 == search2 {print $2}' search1=${SRV} search2=${INSTANCE}`
if [ $pid ]; then
echo "${SRV} already running"
else
uid=`id -u`
if [ ${uid} -ne ${ROOT} -a ${uid} -ne ${USERID} ]; then
echo "ERROR: ${SRV} should run as user '${USER}'"
return
fi
echo -n "Starting ${SRV}... "
if [ ${uid} -eq ${ROOT} ]; then
ulimit -r ${RTPRIO} -s ${STACKSIZE}
su ${USER} -p -c "${SRV} ${INSTANCE} 1>${LOGFILE} 2>&1 &"
else
${SRV} ${INSTANCE} 1>${LOGFILE} 2>&1 &
fi
sleep 2
pid=`ps -ef|awk '$8 == search1 && $9 == search2 {print $2}' search1=${SRV} search2=${INSTANCE}`
if [ ${pid} ]; then
echo "done"
else
echo "FAILED"
fi
fi
}
stopsrv()
{
uid=`id -u`
if [ ${uid} -ne ${ROOT} -a ${uid} -ne ${USERID} ]; then
echo "ERROR: you should be '${USER}' or 'root' to stop ${SRV}"
else
echo -n "Stopping ${SRV}... "
killall ${SRV}
echo "done"
fi
}
statussrv()
{
pid=`ps -ef|awk '$8 == search1 && $9 == search2 {print $2}' search1=${SRV} search2=${INSTANCE}`
if [ ${pid} ]; then
echo "${SRV} running"
else
echo "${SRV} NOT running"
fi
}
#
# main body
#
if [ -f ${CONFFILE} ]; then
. ${CONFFILE}
else
echo "${CONFFILE} not found! Aborting!"
exit 0
fi
case "$1" in
start)
startsrv
;;
stop)
stopsrv
;;
restart)
stopsrv
startsrv
;;
status)
statussrv
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
exit 0
# EOF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment