You are here: Big Brother Bot ForumAdd-OnsConfigurations (Moderator: MordyT)Fully Debian integrated start-stop script
Pages: 1 [2]   Go Down
  Print  
Author Topic: Fully Debian integrated start-stop script  (Read 9054 times) Bookmark and Share
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3483
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #15 on: December 08, 2009, 12:35:42 AM »

Sorry I'm not that familiar with monit install issues nor update-rc.d. I'm afraid I cannot help much on those topics.
Logged


Full Member
***
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 104
Offline Offline
WWW
« Reply #16 on: December 08, 2009, 03:50:38 AM »

Sorry I'm not that familiar with monit install issues nor update-rc.d. I'm afraid I cannot help much on those topics.

OK, no problem. I will figure it out someday Tongue

EDIT:


Remove is possible by doing the following:
Code:
sudo update-rc.d -f  b3 remove

Don't forget to add it afterwards...

Thank you very much, for all the support you gave to me.

Kind regards,
Melroy vd Berg
« Last Edit: December 08, 2009, 08:31:06 AM by danger89 » Logged

JoinMyServer.com
Call of Duty 4 Game Servers
B3 Contrib/Support
*
OS: Linux
Type: Home user
Gameservers: Over see 25 URT servers / B3 servers (not all mine)
Posts: 339
Offline Offline
WWW
« Reply #17 on: March 27, 2010, 05:58:23 AM »

Steps I took for: Ubuntu 9.10 Desktop edition (headless)

Code:
sudo vim /etc/init.d/b3
changed lines
Code:
13, 14, 17, 18, 20 (path to the b3 dir), 21 (full path to b3.xml)

Code:
sudo chmod +x /etc/init.d/b3

Code:
sudo /etc/init.d/b3 start
and got:
Quote
/etc/init.d/b3: 48: Syntax error: "fi" unexpected

so I
Code:
sudo vim /etc/init.d
Quote
:48
Quote
dd
Quote
:wq

then
Code:
sudo /etc/init.d/b3 start
then
Code:
sudo /etc/init.d/b3 status
and got
Quote
*  running


moving on to the auto start on boot:

Code:
sudo update-rc.d b3 defaults
output:
Quote
update-rc.d: warning: b3 stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (S 0 1 6)
 Adding system startup for /etc/init.d/b3 ...
   /etc/rc0.d/K20b3 -> ../init.d/b3
   /etc/rc1.d/K20b3 -> ../init.d/b3
   /etc/rc6.d/K20b3 -> ../init.d/b3
   /etc/rc2.d/S20b3 -> ../init.d/b3
   /etc/rc3.d/S20b3 -> ../init.d/b3
   /etc/rc4.d/S20b3 -> ../init.d/b3
   /etc/rc5.d/S20b3 -> ../init.d/b3

not sure what all that means, but I hope it's safe to ignore  and hope this helps any Ubuntu users.
« Last Edit: July 02, 2010, 03:49:41 AM by ryry46d9 » Logged
Full Member
***
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 104
Offline Offline
WWW
« Reply #18 on: March 27, 2010, 06:37:29 AM »

Read my message:

http://www.bigbrotherbot.com/forums/configurations/fully-debian-integrated-start-stop-script/msg8926/#msg8926
Quote
Please fix your code, remove line 47:
Code:
    fi



Steps I took for: Ubuntu 9.10 Desktop edition (headless)

Code:
sudo vim /etc/init.d/b3
changed lines
Code:
13, 14, 17, 18, 20 (path to the b3 dir), 21 (full path to b3.xml), 25(since I have 5 bots)

Code:
sudo chmod +x /etc/init.d/b3

Code:
sudo /etc/init.d/b3 start
and got:
so I
Code:
sudo vim /etc/init.d
then
Code:
sudo /etc/init.d/b3 start
then
Code:
sudo /etc/init.d/b3 status
and got

moving on to the auto start on boot:

Code:
sudo update-rc.d b3 defaults
output:
not sure what all that means, but I hope it's safe to ignore  and hope this helps any Ubuntu users.
Logged

JoinMyServer.com
Call of Duty 4 Game Servers
B3 Contrib/Support
*
OS: Linux
Type: Home user
Gameservers: Over see 25 URT servers / B3 servers (not all mine)
Posts: 339
Offline Offline
WWW
« Reply #19 on: March 27, 2010, 06:50:50 AM »

my error was line 48

what flavor of Linux are you running? and how many bots? I haven't tried to restart that box yet, I'm still working on other config's but if it's Ubuntu just start over from scratch trying my way.

the bots been up for one hour now
Quote
100327 06:40:02 BOT     www.BigBrotherBot.com (b3) v1.2.2b-20100224 [posix] (Daniel)
100327 06:40:02 BOT     Python: 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1]
100327 06:40:02 BOT     Starting Iourt41Parser server for 192.168.6.50:27960

Quote
100327 07:43:23 CONSOLE 651:26 say: 0 RYRY46d9: !STATUS
100327 07:43:23 VERBOSE Client Found: RYRY46d9 on slot 0
100327 07:43:23 VERBOSE Queueing event Say !STATUS
100327 07:43:23 VERBOSE Parsing Event: Say: ChatloggerPlugin
100327 07:43:23 DEBUG   ChatloggerPlugin: ALL, 2, RYRY46d9, !STATUS
100327 07:43:23 DEBUG   ChatloggerPlugin: query: INSERT INTO chatlog (msg_time, msg_type, client_id, client_name, client_team, msg) VALUES (1269701003, "ALL", 2, "RYRY46d9", 1, "!STATUS")
100327 07:43:23 DEBUG   ChatloggerPlugin: rowcount: 1, id:6277
100327 07:43:23 VERBOSE Parsing Event: Say: ChatPlugin
100327 07:43:23 VERBOSE Parsing Event: Say: SpamcontrolPlugin
100327 07:43:23 VERBOSE Parsing Event: Say: AdminPlugin
100327 07:43:23 DEBUG   AdminPlugin: OnSay handle 5:"!STATUS"
100327 07:43:23 DEBUG   AdminPlugin: Handle command !STATUS
100327 07:43:23 VERBOSE RCON sending (192.168.6.50:27960) tell 0 ^2(^2The Babysitter^2)^7: ^3[pm]^7 ^7Database appears to be ^2UP
 

Logged
Full Member
***
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 104
Offline Offline
WWW
« Reply #20 on: March 27, 2010, 08:07:15 AM »

The error was in 48 the solution is on line 47...
Logged

JoinMyServer.com
Call of Duty 4 Game Servers
B3 Contrib/Support
*
OS: Linux
Type: Home user
Gameservers: Over see 25 URT servers / B3 servers (not all mine)
Posts: 339
Offline Offline
WWW
« Reply #21 on: March 27, 2010, 09:34:15 AM »

either way Wink  48 was deleted and it works
Logged
Full Member
***
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 104
Offline Offline
WWW
« Reply #22 on: March 27, 2010, 01:22:45 PM »

Ok nice, maybe there is a new version or I just removed a white line Tongue
Logged

JoinMyServer.com
Call of Duty 4 Game Servers
B3 Contrib/Support
*
OS: Linux
Type: Home user
Gameservers: Over see 25 URT servers / B3 servers (not all mine)
Posts: 339
Offline Offline
WWW
« Reply #23 on: September 29, 2010, 03:03:50 PM »

Hey Courgette  I trided to change the line
Code:
DAEMON_ARGS="$B3_BASEDIR/b3_run.py -c $B3_CONFIGFILE"

to read
Code:
DAEMON_ARGS="$B3_BASEDIR/b3_run.py -r -c $B3_CONFIGFILE"
&
Code:
DAEMON_ARGS="$B3_BASEDIR/b3_run.py -rc $B3_CONFIGFILE"

but the bot fails to start with no logging. Do you know what the correct syntext  would be so I can get !restart working?

I been busy on other projects and the "how to restart in game" has been locked so I posted here, and yes they are 1.34b
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3483
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #24 on: September 29, 2010, 03:46:02 PM »

try
Code:
DAEMON_ARGS="$B3_BASEDIR/b3_run.py --restart -c $B3_CONFIGFILE"
(just a guess)
Logged

[ www.xlrstats.com ]
Project Lead
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD, CoD2, CoD5, UrT
Posts: 2022
Offline Offline
WWW
Support Specialty: B3-Core, CoD/UrT/WoP/ETPro parsers, Plugin development
« Reply #25 on: October 03, 2010, 02:57:33 AM »

Code:
b3_run.py -r -c <configfile>
works fine on my end... are your paths correct?
Logged

Jr. Member
**
OS: Windows
Type: Owner dedicated server(s)
Gameservers: BFBC2, CoDBO, BF3
Posts: 23
Offline Offline
WWW
« Reply #26 on: January 06, 2011, 02:02:12 AM »

guys are all easier
to delete line 48 (fi)
and erase on line 20 (B3_BASEDIR = / bot/b3_run.py)
because it is duplicated in line 23 (DAEMON_ARGS = "$B3_BASEDIR/b3_run.py -c $B3_CONFIGFILE")
because of this there is a conflict))) is all that is needed to correct)) and it will work! Wink
Logged
Newbie
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD4, CoDUO
Posts: 1
Offline Offline
« Reply #27 on: January 13, 2011, 04:05:40 AM »

full, script Smiley  Shocked

Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          BigBrotherBot
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Main-Date          2011.01.13
# Short-Description: BigBrotherBot Start-Stop-Restart
# Description:       BigBrotherBot
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SCRIPTNAME=/etc/init.d/$NAME
DAEMON=`which python`


B3_BASEDIR="/xxx/xxx/xxxx/b3"                                     <--------- Full Path Dir.
B3_CONFIGFILE="/xxx/xxxx/xxxx/b3/b3/conf/b3.xml"     <--------- Full Path Configfiles.
B3_PID_FILE="/var/run/bigbrotherbot/${NAME}.pid"
DAEMON_ARGS="$B3_BASEDIR/b3_run.py -c $B3_CONFIGFILE"

# Exit if the package is not installed
if [ ! -x "$DAEMON" ]; then
{
        echo "Couldn't find $DAEMON"
        exit 99
}
fi

PIDDIR=`dirname "$B3_PID_FILE"`
if [ "$PIDDIR" -a "$PIDDIR" != "/var/run" ] ; then
   if [ ! -d "$PIDDIR" ] ; then
      mkdir "$PIDDIR"
   fi
   if [ "$DAEMON_USER" ] ; then
       chown "$DAEMON_USER" "$PIDDIR"
   fi
   if [ "$DAEMON_GROUP" ] ; then
       chgrp "$DAEMON_GROUP" "$PIDDIR"
   fi
    fi

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that check the daemon/service
#
do_status()
{
      NB_PROCESS=`ps ax | grep b3_run | grep "$B3_CONFIGFILE" | grep -v grep | wc -l`
      if [ $NB_PROCESS -gt 1 ]; then
         log_warning_msg "WARNING: $NAME is running multiple times"
            return 0
      elif [ $NB_PROCESS -eq 1 ]; then
         return 0
      else
            return 1
      fi
}

#
# Function that starts the daemon/service
#
do_start()
{
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started
   start-stop-daemon --start --quiet --chuid $DAEMON_USER:$DAEMON_GROUP --pidfile $B3_PID_FILE --make-pidfile \
        --background --chdir $B3_BASEDIR --startas $DAEMON -- $DAEMON_ARGS
    return $?
}

#
# Function that stops the daemon/service
#
do_stop()
{
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred
   start-stop-daemon --stop --signal 15 --retry 5 --quiet --pidfile $B3_PID_FILE
   RETVAL="$?"
    [ "$RETVAL" = 0 ] && rm -f $B3_PID_FILE
   [ "$RETVAL" = 2 ] && return 2
   return "$RETVAL"
}

do_kill() {
        while [ 1 ]; do
            PID=`ps hax | grep "b3_run" | grep "$B3_CONFIGFILE" | grep -v grep | cut -d' ' -f1 | head -n1`
            [ "$PID" = "" ] && return
            log_daemon_msg "killing process [$PID]"
            kill -9 $PID
        done
}

case "$1" in
  start)
   log_daemon_msg "Starting $DESC" "$NAME"
   do_start
   case "$?" in
      0|1) log_end_msg 0 ;;
      2)  log_end_msg 1 ;;
   esac
   ;;
  stop)
   log_daemon_msg "Stopping $DESC" "$NAME"
   do_stop
   case "$?" in
      0|1) log_end_msg 0 ;;
      2) log_end_msg 1 ;;
   esac
   ;;
  status)
   do_status
   case "$?" in
      1) log_success_msg " stopped" ;;
      0) log_success_msg " running" ;;
   esac
   ;;
  kill)
    log_daemon_msg "Killing all process b3_run using $B3_CONFIGFILE"
    do_kill
    log_end_msg 0
    ;;
  restart|force-reload)
   log_daemon_msg "Restarting $DESC" "$NAME"
   do_stop
   case "$?" in
     0|1)
      do_start
      case "$?" in
         0) log_end_msg 0 ;;
         1) log_end_msg 1 ;; # Old process is still running
         *) log_end_msg 1 ;; # Failed to start
      esac
      ;;
     *)
        # Failed to stop
      log_end_msg 1
      ;;
   esac
   ;;
  *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
   exit 3
   ;;
esac

:
« Last Edit: January 13, 2011, 04:08:53 AM by XMSK » Logged
Tags:
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal