collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Bebot on linux  (Read 19728 times)

0 Members and 2 Guests are viewing this topic.

Offline Sojourner

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
    • http://majestic.webhop.net
Bebot on linux
« on: August 30, 2005, 07:39:15 pm »
Had to flip through a couple posts on here and look for some stuff on the web to get up and running, so thought I'd try to make a single post for what I had to do to get up and running on a linux box.

First off, I'm no where close to a *nix guru of any sort.  Using a linux box for our org bots and web pages was a first go at using linux for me.   So, any corrections, simplifications, or helpful hints anyone has is appreciated.

Second, the box I installed on is runng Ubuntu, a flavor of Debian Linux.  So, some commands may differen based on your version.  But, hopefully this will be helpful.


Here we go:

1) Make sure you have php4-cli and php4-mysql installed
   $ dpkg -l | grep php

   You want to see -
      ii  php4-cli       4.3.10-10ubunt command-line interpreter for the php4 script
      ii  php4-mysql     4.3.10-10ubunt MySQL module for php4

   If you don't have either of them, install them
      $ sudo apt-get install php4-cli
      $ sudo apt-get install php4-mysql



2) Make sure you have the mysql server installed
   $ dpkg -l | grep mysql

   You want to see -
      ii  mysql-server-4 4.1.10a-2ubunt mysql database server binaries

   If you don't have it, install it
      $ sudo apt-get install mysql-server-4.1


3) Make sure you have unzip installed to unzip the files we download
   $ dpkg -l | grep unzip

   You want to see -
      ii  unzip          5.51-2ubuntu1. De-archiver for .zip files

   Otherwise install it
      $ sudo apt-get install unzip



4) Download the bebot files and the items db for it.  Commands here are for the current link to v0.2.1.1 and items db for 15.8.4, the exact url may change, double check Here first.
   From the directory you want to install bebot in:
      $ wget http://bebot.fieses.net/files/bebot_v0211.zip
      $ wget http://bebot.fieses.net/files/items150804.zip


   Once the files are downloaded, unzip the main bot files
      $ unzip bebot_v0211.zip

   Then, unzip the items database.  When you get the warning about overwriting the file, allow it
      $ unzip items150804.zip -d bebot


5) Configure the mysql database
   Log into mysql
      $ mysql -u root

   Create the database.  I called mine bebot (don't forget the semi-colon at the end of the line)
      mysql> CREATE DATABASE bebot;

   Make the new database the one you're issuing commands to
      mysql> USE bebot;

   Upload the items db file into the database.  
   I put my bebot directory in my home directory, so I used:
      mysql> SOURCE /home/MyUserName/bebot/items.sql;

   You'll get a ton of lines updated messages, and then everything is loaded

   Create a user in mysql that the bot can logon with
   This command gives the user "bebot" access to all tables on database bebot
   If they log in from the local host with the password 'bebotpassword'
   Again, don't forget the semi-colon on the second line but not the first
      mysql> GRANT ALL PRIVILEGES ON bebot.* TO 'bebot'@'localhost'
          -> IDENTIFIED BY 'bebotpassword' WITH GRANT OPTION;


6) Configure the bot's start.php file
   Use vi or gedit, or what ever editor program you use to configure these two lines
   The exact path to php may be slightly different for you
      $php_bin = "/usr/bin/php";
      $main_php = "./main.php";


7) Configure the Bot.conf file in the conf directory
   Most everything in there has self-explanatory comments.
   You can also look Here for information on configuring it for a radibot, or Here for a Guildbot


8) Configure the MySQL.conf file in the conf directory
   If you used all of the examples above, word for word, it would look like this:
       $dbase = "bebot";
       $user = "bebot";
       $pass = "bebotpassword";
       $server = "localhost";

9) Start the bot to make sure it works
   From the bebot directory:
      $ php ./start.php

10) If the bot loads, logs on, and everything is good, shut it down and finish up.  If not, you'll have to do some troubleshooting


11) Mark or move modules you don't want the bot to load.
   Look in the modules directory.  Any modules you don't want to bot to use/load you can rename to start with a _
      change Sever.php to _Server.php for example

   Or, I created an "Unused" directory in the module directory and moved the unwanted ones there, so I don't have to even look at them


12) Download any additional modules you want to load
   Look Here to see what is available


13) ((Optional)) Rename start.php to RAIDBOT.php, or something more easily recognized.  
   I run the bot in the background, so to kill it from command line, have to grep the ps to get the pid
   start.php seemed a bit generic to me, so I have it a name I can easily look for and certainly will not be used
      by anything I load in the future.


14) Start the bot again
   From the bebot directory:
      $ php ./RAIDBOT.php
   

15) If you get errors, go back and troubleshoot the modules, since you got it to work correctly earlier.  If it loads, you can kill it one last time and use this command to run it in the background and continue running even after you log off your sever:
   $ nohup php ./RAIDBOT.php &


16) Set up the Bot members
   If you're running a raid bot, Bot Admin does not equal bot member, so:
      Log onto the game with whoever you made bot admin
      "/tell BotName !member YourName"

      You can then add other members, andmins, and such manually

   If you're running a guild bot, once it starts up, it takes a couple minutes to get all the data from
      funcom's site, and then you should be good.

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
Bebot on linux
« Reply #1 on: August 31, 2005, 10:24:15 am »
Nice tutorial there. I like it.
Quote from: "Sojourner"
I run the bot in the background, so to kill it from command line, have to grep the ps to get the pid

You might consider running the bot in "screen". That is a virtual console that you can connect to and disconnect from:

Code: [Select]
Start a new screen:
  screen -S mybot

Disconnect from the screen:
  Ctrl+a then d

Reconnect to the screen:
  screen -r mybot

To terminate a screen:
  log onto the screen
  terminate bot with Ctrl+c incase its still running (or use !shutdown)
  Type "exit"


This way when running the bot on a server and just beeing able to connect to the server via ssh you can always just log onto the screen an see what your bot is doing. When done just disconnect from it again and the bot will continue running and dumping its info into the screen's console.

Offline Sojourner

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
    • http://majestic.webhop.net
Bebot on linux
« Reply #2 on: August 31, 2005, 06:57:05 pm »
Hmm, I've only got cli on the box, no XWindow / GUI / etc.

Does the screen command still apply?  Commands don't work on the box I have, no man for it, can't seem to find anything online (screen too generic of a search word)

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
Bebot on linux
« Reply #3 on: September 01, 2005, 01:14:45 am »
If you got a Debian system (like Ubuntu):
Code: [Select]
sudo apt-get install screen

Its purely console based... slim and next to no extra CPU/Mem usage... Very usefull for running console apps through shh on a linux machine. I have 3 BeBot versions and several other proggys running over it... (if you just use "screen" to start a screen without the "-S name" you can reconnect to the screen using "screen -r pid_of_screen"... or just "screen -r" incase you only have one screen running. If you have more than one screen running "screen -r" will bring you a list of all screens you can reconnect to.
Here the manpage of it: click

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Bot Check for Linux
« Reply #4 on: September 05, 2005, 03:46:57 pm »
I created a small perl script to make sure my bot is running and haven't seen anything like it on the boards, so I am sharing it here.  8)

Shelly

bot_check.pl
Code: [Select]
#!/usr/bin/perl

# Author: Shelly
# Notes:
# 1. Replace all "YourBotName" with what ever the name of your bot.
# 2. Replace your_account\@your_mail_host with the email address you want to recieve your
# logs and notifications at.
# 3. I also place the bot in it's own directory (YourBotName), but save the logs in bebot's home directory.
# This way I can run multiple bots.
# 4. Crontab Entry for Fedora Core/ Vixie Cron
# 0/10 * * * * cd /home/bot; ./bot_check.pl >/dev/null

#
##
### Check for AO Bots and restart if necessary
##
## bebot 12007 11929 0 11:45 pts/0 00:00:00 php -f YourBotName/start.php
#

$mdate = `date +%b-%d-%Y`;

$z = `ps -ef |grep YourBotName |grep -v grep`;
chop($z);
if ($z eq "")
{
system("mail your_account\@your_mail_host -s \"Starting YourBotName bot on web1\" </home/bebot/YourBotName.log");
system("mv /home/bebot/YourBotName.log /home/bebot/YourBotName.log-${mdate}");
system("cd /home/bebot; /usr/local/bin/php -f /home/bebot/YourBotName/start.php > /home/bebot/YourBotName.log &");
}

*edit 16 Nov 2011 --->
I made a different version that is just tied to the bash shell... See below: This one is a bit easier to configure than my original above...

start_bot.sh
Code: [Select]
#!/bin/bash
 
#
##
### Check FC Bots and start if necessary
##
#
# This script looks to see if your bot is actually running and does nothing if it is
# already running.
# If it is not running, it will email you the previous log, then compress it to conserve space.
#

# The BOT* items you will need to configure for your bot.
BOTHOME="/home/bot/OrgBots"
BOTNAME="Your Bot Name here"
# I use the account I use to run the bots' home directory here
BOTLOGS="/home/bot"
# Where you want to save the old logs to.
BOTLOG_Archive=${BOTLOGS}/logs
someone_who_cares="[email protected]"

mdate=`date +%b-%d-%Y`;
hdate=`date +%b-%d-%Y_%H%M_hrs`;

z=`ps -ef |grep ${BOTNAME} |grep -v grep`;
if [[ $z == "" ]]
then {
  # comment this next line out if you don't want the previous log emailed to you.
  mailx -s "Starting ${BOTNAME} bot " ${someone_who_cares} <${BOTLOGS}/${BOTNAME}.log ;
  if [ -e "${BOTLOGS}/${BOTNAME}.log-${mdate}.gz" ]
  then {
    mv ${BOTLOGS}/${BOTNAME}.log ${BOTLOG_Archive}/${BOTNAME}.log-${mdate};
    /bin/gzip ${BOTLOG_Archive}/${BOTNAME}.log-${mdate};
  }
  else {
    mv ${BOTLOGS}/${BOTNAME}.log ${BOTLOG_Archive}/${BOTNAME}.log-${hdate};
    /bin/gzip ${BOTLOG_Archive}/${BOTNAME}.log-${hdate};
  };
  fi
  cd ${BOTHOME}; /usr/bin/php -f ${BOTHOME}/StartBot.php ${BOTNAME} 2>&1 > ${BOTLOGS}/${BOTNAME}.log &
}
fi

#EOF
« Last Edit: November 17, 2011, 03:35:42 am by Shelly »

Offline Zarkingu

  • Contributor
  • *******
  • Posts: 34
  • Karma: +0/-0
Re: Bebot on linux
« Reply #5 on: January 28, 2006, 04:49:12 am »
I've just thrown my old Win2003 server out the window and got a brand new Kubuntu server up and running. I've come as far as to the bot login, but getting an error when the bot it authenticating.

Code: [Select]
AOChat: not expecting login.
Any clues as to what might be wrong?

This is what I got installed:
php4-cli  4.4.0-3
php4-mysql 4.4.0-3

mysql-server 4.0.24 10ubuntu2 mysql database server binaries
Zarkingu 210 MP RK2

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Bebot on linux
« Reply #6 on: January 28, 2006, 05:37:25 am »
BeBot Founder and Fixer Kingpin

Offline dioniz84

  • BeBot Rookie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Bebot on linux
« Reply #7 on: November 21, 2009, 10:18:20 am »
I have followed this guide to the line. Plus this one: http://bebot.link/wiki/installation

But I get this msg when sterting bot:
Code: [Select]
MySQS supprot required to run this botPHP Notice: Undefined variable: pw in /.../Start.php on line 100
Any ideas??

I have php and mySQL installed. And databeses are there.

Problrm 2:
 all   $ dpkg commands ends with - :command not fount. AAAAA!!!
« Last Edit: November 21, 2009, 11:21:08 am by dioniz84 »

Offline dioniz84

  • BeBot Rookie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Bebot on linux
« Reply #8 on: November 22, 2009, 01:06:13 pm »
Ok,
I know where is the problem.
I combined 2 methods 2 one and it was 1 for windows and one for Linux. Bad!! Bad!! Bad!!
I had :
      php.exe
      ssleay32.dll
     php_curl.dll
      php_mbstring.dll
      php_mysql.dll
      php_sockets.dll
In bot's directories so it couldn't connect to the oryginal Linux ones. Now when I removed them I'm missing some extensions, but it;s just a meter of getting them. More or less problem solved.

Offline Zweiblum

  • BeBot Apprentice
  • ***
  • Posts: 135
  • Karma: +0/-0
Re: Bebot on linux
« Reply #9 on: January 13, 2011, 02:24:41 pm »
Hey guys,
currently im hosting multipli bots on a windows system and i want to switch to ubuntu soon.
Is this guide still viable?
And will the mysql-backup be supported under ubuntu?

thx

Offline Kentarii

  • BeBot Apprentice
  • ***
  • Posts: 153
  • Karma: +0/-0
    • AoC>TV
Re: Bebot on linux
« Reply #10 on: January 13, 2011, 02:43:54 pm »
If you mean the guide in the OP, it's ancient...

Check the wiki: http://bebot.link/wiki/installation or the ReadMe.txt in the BeBot-0.6.8.tar.gz archive.

For backup, I use: http://sourceforge.net/projects/automysqlbackup/

Offline Zweiblum

  • BeBot Apprentice
  • ***
  • Posts: 135
  • Karma: +0/-0
Re: Bebot on linux
« Reply #11 on: January 14, 2011, 12:07:40 pm »
thx for the hint with the ReadMe, will look at it asap.
Is this sqlbackuptool useable under ubuntu 8.04?

Thx for ur help!

Offline Kentarii

  • BeBot Apprentice
  • ***
  • Posts: 153
  • Karma: +0/-0
    • AoC>TV
Re: Bebot on linux
« Reply #12 on: January 14, 2011, 12:51:28 pm »
thx for the hint with the ReadMe, will look at it asap.
Is this sqlbackuptool useable under ubuntu 8.04?

Thx for ur help!
Yes, it's just a shell script which uses mysqldump to create database dump and rotates your backup.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 488
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal