Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
server daemon problem (start, stop, etc)
#1
We've run through the documentation for installing Babel a few times and we've run into the same thing every time. Any help would be appreciated. We running CentOS 5 with a 2.6.18-8.el5 kernel.

When trying to start the server we get...

[[email protected] init.d]# /etc/init.d/babelserver_daemon start
Starting Babel server/etc/init.d/babelserver_daemon: line 22: start-stop-daemon: command not found
.

---

[[email protected] init.d]# sh -x babelserver_daemon
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
+ NAME='Babel server'
+ DAEMON=/usr/local/bin/babelserver
+ PIDFILE=/var/run/babelserver.pid
+ '[' '!' -f /usr/local/bin/babelserver ']'
+ case "$1" in
+ echo 'Uso: babelserver_daemon {start|stop|restart|force-reload}'
Uso: babelserver_daemon {start|stop|restart|force-reload}
+ exit 1
 Reply
#2
start-stop-daemon is a feature of debian based distros, centOS is redhat based.
 Reply
#3
Hi,
reusing pandora server init script, i obtain a babelserver script that not needs start-stop-daemon.
I test it on CentOS 5.1 and seems to work fine.

bye

--------------------------------------------------------------------------------

#!/bin/bash

# Babel Enterprise, startup script
#
# Linux Version (generico)
#

# Configurable path and filenames
BABEL_HOME="/usr/local/etc/babel/babel_server.conf"
BABEL_PID_PATH="/var/run"
BABEL_PID=$BABEL_PID_PATH/babelserver.pid
BABEL_DAEMON=/usr/local/bin/babelserver

# Main script

if [ ! -d "$BABEL_PID_PATH" ]
then
echo "Babel Enterprise cannot write it's PID file in $BABEL_PID_PATH. Please create that directory"
exit
fi

if [ ! -f $BABEL_DAEMON ]
then
echo "Babel Enterprise not found, please check setup and read manual"
exit
fi

case "$1" in
start)
OLD_PATH="`pwd`"
if [ -f $BABEL_PID ]
then
CHECK_PID=`cat $BABEL_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "babelserver" | wc -l`
if [ $CHECK_PID_RESULT == 1 ]
then
echo "Babel Enterprise is currently running on this machine with PID ($CHECK_PID). Aborting now..."
exit
fi
fi

$BABEL_DAEMON $BABEL_HOME -D
sleep 1

MYPID=`ps aux | grep "$BABEL_DAEMON" | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ]
then
echo $MYPID > $BABEL_PID
echo "Babel Enterprise is now running with PID $MYPID"
else
echo "Cannot start Babel Enterprise. Aborted."
fi
cd "$OLD_PATH"
;;
stop)
if [ -f $BABEL_PID ]
then
echo "Stopping Babel Enterprise"
PID_2=`cat $BABEL_PID`
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'babelserver' `" ]
then
kill `cat $BABEL_PID` 2> /dev/null > /dev/null
fi
rm -f $BABEL_PID
else
echo "Babel Enterprise is not running, cannot stop it."
fi
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: babelserver {start|stop|restart}"
exit 1
esac
 Reply
#4
That should work.

Anyway, I'm going to make a start script daemon for RedHat based distros, I'll do it as soon as I have some time Smile
 Reply
#5
Ehm... there is an error Smile

change this line:
$BABEL_DAEMON $BABEL_HOME -D

with this one:
$BABEL_DAEMON -c $BABEL_HOME &

sorry...

bye
 Reply
#6
You might want to add "nohup" as well.
 Reply
#7
Thanks all.. the script with the minor change worked, you do not need the nohup.

#!/bin/bash

# Babel Enterprise, startup script
#
# Linux Version (generico)
#

# Configurable path and filenames
BABEL_HOME="/usr/local/etc/babel/babel_server.conf"
BABEL_PID_PATH="/var/run"
BABEL_PID=$BABEL_PID_PATH/babelserver.pid
BABEL_DAEMON=/usr/local/bin/babelserver

# Main script

if [ ! -d "$BABEL_PID_PATH" ]
then
echo "Babel Enterprise cannot write it's PID file in $BABEL_PID_PATH. Please create that directory"
exit
fi

if [ ! -f $BABEL_DAEMON ]
then
echo "Babel Enterprise not found, please check setup and read manual"
exit
fi

case "$1" in
start)
OLD_PATH="`pwd`"
if [ -f $BABEL_PID ]
then
CHECK_PID=`cat $BABEL_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "babelserver" | wc -l`
if [ $CHECK_PID_RESULT == 1 ]
then
echo "Babel Enterprise is currently running on this machine with PID ($CHECK_PID). Aborting now..."
exit
fi
fi

#$BABEL_DAEMON $BABEL_HOME -D
$BABEL_DAEMON -c $BABEL_HOME &

sleep 1

MYPID=`ps aux | grep "$BABEL_DAEMON" | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ]
then
echo $MYPID > $BABEL_PID
echo "Babel Enterprise is now running with PID $MYPID"
else
echo "Cannot start Babel Enterprise. Aborted."
fi
cd "$OLD_PATH"
;;
stop)
if [ -f $BABEL_PID ]
then
echo "Stopping Babel Enterprise"
PID_2=`cat $BABEL_PID`
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'babelserver' `" ]
then
kill `cat $BABEL_PID` 2> /dev/null > /dev/null
fi
rm -f $BABEL_PID
else
echo "Babel Enterprise is not running, cannot stop it."
fi
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: babelserver {start|stop|restart}"
exit 1
esac
 Reply
#8
I tested it today, it works fine, I'll upload it to the SVN to package it in the next package releases, which are going to be packaged soon, as 2.0 release is about to be announced.
 Reply
#9
Great!!!
 Reply


Users browsing this thread: 2 Guest(s)


(c) 2006-2018 Artica Soluciones Tecnol├│gicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes