Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!

Author Topic: bash script to start/stop/restart b3  (Read 28901 times)

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: bash script to start/stop/restart b3
« Reply #15 on: March 04, 2011, 03:47:29 PM »
you should make a user called b3 i think, or change
Code: [Select]
## the user that must be used to run the bot
USER=b3
to your unix username (not really safe to use root imho)
-edit-
hm i couldnt change it to my user, so  i did use root.
Gonna reboot now
-edit2-
works like a charm (using 3 b3 bots so far)

Nice. Maybe you could make some sort of video tutorial on this? I never did get this script working right...
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline TmR

  • Full Member
  • ***
  • Posts: 94
Re: bash script to start/stop/restart b3
« Reply #16 on: March 25, 2011, 08:54:43 AM »
Nice. Maybe you could make some sort of video tutorial on this? I never did get this script working right...
doh =) i used copy & paste + webmin :O
-edit-
Will make a text based tut then ok?
« Last Edit: March 25, 2011, 10:42:57 AM by TmR »

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: bash script to start/stop/restart b3
« Reply #17 on: March 25, 2011, 05:46:51 PM »
Sure, I that would be awesome.
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline TmR

  • Full Member
  • ***
  • Posts: 94
Re: bash script to start/stop/restart b3
« Reply #18 on: March 25, 2011, 09:34:37 PM »

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: Re: bash script to start/stop/restart b3
« Reply #19 on: March 27, 2011, 07:58:36 AM »
Thanks! Will test soon...

Sent from my HTC Glacier
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline Spruehwurstheinz

  • Sr. Member
  • ****
  • Posts: 234
Re: bash script to start/stop/restart b3
« Reply #20 on: May 25, 2011, 09:26:33 PM »
Code: [Select]
I've a problem which sounds quite weird to me:
[quote]
[email protected]:~$ sudo find /usr/bin | grep python
/usr/bin/dh_python
/usr/bin/python2.5
/usr/bin/python
I've installed python 2.5.2 and 2.7 on my debian system.
Whenever I start B3 manually with
Code: [Select]
[email protected]:~$ python b3_run.py
It uses python 2.7 like it's supposed to do:
Quote
110525 21:22:01 BOT     www.bigbrotherbot.net (b3) v1.7.0a [posix] [Sedici]
110525 21:22:01 BOT     Python: 2.7.1 (r271:86832, Jan 25 2011, 21:23:29)
When I use the start script with:
Code: [Select]
[email protected]:~$ ./b3start.sh start
It uses python 2.5:
Quote
110525 21:23:09 BOT     www.bigbrotherbot.net (b3) v1.7.0a [posix] [Sedici]
110525 21:23:09 BOT     Python: 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
My start script has the python 2.7 path in it:
Code: [Select]
## where the python binary is located
PYTHON_BIN=/usr/bin/python

So please help me  :)

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: bash script to start/stop/restart b3
« Reply #21 on: May 25, 2011, 09:37:36 PM »
try
Code: [Select]
PYTHON_BIN=/usr/bin/python2.7

Offline Spruehwurstheinz

  • Sr. Member
  • ****
  • Posts: 234
Re: bash script to start/stop/restart b3
« Reply #22 on: May 25, 2011, 09:54:11 PM »
doesn't work, the python2.7.1 is definitly installed at /usr/bin/python

I wouldn't been able to start b3 with "python b3_run.py" with python version 2.7.1 if it's not in this directory?  :(

Offline Spruehwurstheinz

  • Sr. Member
  • ****
  • Posts: 234
Re: bash script to start/stop/restart b3
« Reply #23 on: May 26, 2011, 08:44:48 AM »
I just changed it now like that:
Code: [Select]
function do_start {
        cd $(dirname $B3_BIN)
        python $B3_BIN $B3_OPTS &
        echo $! > $B3_PID_FILE
}
it works with python 2.7.1, but I'm confused that it doesn't work with the /usr/bin/python, that should be the hardlink for python 2.7.1. ...

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: bash script to start/stop/restart b3
« Reply #24 on: May 26, 2011, 10:36:09 AM »
Try :
Code: [Select]
function do_start {
        cd $(dirname $B3_BIN)
        $PYTHON_BIN $B3_BIN $B3_OPTS &
        echo $! > $B3_PID_FILE
}

Offline Spruehwurstheinz

  • Sr. Member
  • ****
  • Posts: 234
Re: bash script to start/stop/restart b3
« Reply #25 on: May 26, 2011, 10:44:29 AM »
same problem, using old python instead of the 2.7.1

Offline Storm3y

  • Jr. Member
  • **
  • Posts: 35
Re: bash script to start/stop/restart b3
« Reply #26 on: June 09, 2011, 11:55:41 PM »
doesnt seem to work for me when issuing ./bigbrotherbot start I get no response. I did when I had errors with config path but now I have corrected it it doesnt work.


EDIT:
TmR's seems to work.

Only works with one B3 install. When I added the same script to a different dir it says it's already running.
« Last Edit: June 10, 2011, 02:51:17 AM by Storm3y »

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: bash script to start/stop/restart b3
« Reply #27 on: June 10, 2011, 03:14:03 PM »
Modify the script to point to config 2?
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline Storm3y

  • Jr. Member
  • **
  • Posts: 35
Re: bash script to start/stop/restart b3
« Reply #28 on: June 10, 2011, 05:10:06 PM »
Modify the script to point to config 2?

How would I do that? I have 2 seperate installs of b3. One in /home/b3/cod4 and one in /home/b3/cod7 and that script in both directory.

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: bash script to start/stop/restart b3
« Reply #29 on: June 10, 2011, 05:13:13 PM »
I assume you have to modify the script to point to install 2...
Take a look at:
B3_CONFIGFILE="/home/b3/b3bot_tmr/b3/conf/b3_tmr.xml" 
And stuff like that. Post the full script you are using and I will take a closer look.

(As a side note, you don't need 2 separate installs. You can start the same install with a different config file.)
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

 


Rate this page +1 at Google Search