Pages: [1]   Go Down
Author Topic: server daemon problem (start, stop, etc)  (Read 1443 times)
0 Members and 2 Guests are viewing this topic.
mmangone
Newbie
*

Karma: 0
Offline Offline

Posts: 8


View Profile
« on: May 08, 2008, 06:14:50 PM »

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...

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

---

[root@monitor 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
« Last Edit: January 01, 1970, 01:00:00 AM by mmangone » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #1 on: May 09, 2008, 07:18:04 AM »

start-stop-daemon is a feature of debian based distros, centOS is redhat based.
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

shaveht
Newbie
*

Karma: 0
Offline Offline

Posts: 3


View Profile
« Reply #2 on: May 12, 2008, 05:02:41 PM »

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
« Last Edit: January 01, 1970, 01:00:00 AM by shaveht » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #3 on: May 12, 2008, 07:44:15 PM »

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 :)
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

shaveht
Newbie
*

Karma: 0
Offline Offline

Posts: 3


View Profile
« Reply #4 on: May 13, 2008, 07:43:31 AM »

Ehm... there is an error :)

change this line:
$BABEL_DAEMON $BABEL_HOME -D

with this one:
$BABEL_DAEMON -c $BABEL_HOME &

sorry...

bye
« Last Edit: January 01, 1970, 01:00:00 AM by shaveht » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #5 on: May 13, 2008, 10:02:31 AM »

You might want to add "nohup" as well.
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

mmangone
Newbie
*

Karma: 0
Offline Offline

Posts: 8


View Profile
« Reply #6 on: May 19, 2008, 10:01:12 PM »

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
« Last Edit: January 01, 1970, 01:00:00 AM by mmangone » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #7 on: May 20, 2008, 08:30:17 PM »

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.
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

shaveht
Newbie
*

Karma: 0
Offline Offline

Posts: 3


View Profile
« Reply #8 on: May 21, 2008, 06:08:31 PM »

Great!!!
« Last Edit: January 01, 1970, 01:00:00 AM by shaveht » Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST