How To: Budabot on Linux

Questions, comments, suggestions, and bug reports
Krause
Member
Posts: 2
Joined: Tue Aug 22, 2017 7:00 am

Re: How To: Budabot on Linux

Postby Krause » Tue Aug 22, 2017 12:25 pm

twist3ed wrote:Has anybody installed this on Ubuntu 16 with php 7 yet?

This guide is rather outdated now.


Works great, using 7.2 right now. You just need to select the additional bcmath, curl, gmp, sqlite (if you're using sqlite) and xml packages from whichever version of PHP 7 you're planning on using.

Anyone running Budabot in the background as a service? I'm currently running it on a desktop system in a terminal window thats started from Ubuntu's GUI based Startup Applications program and will soon be moving it over to a small machine running Ubuntu Server. I would like for it to run as a service/daemon in the background without needing to login, is this possible? If not what would be the best way for a system like that, autologin along with a login script that runs the bot?
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: How To: Budabot on Linux

Postby Tyrence » Tue Aug 22, 2017 7:24 pm

I have only ever run Budabot inside of screen but it doesn't have facilities for restarting Budabot automatically. I have relied on the chatbot.sh script included with Budabot to handle that (which works well generally, but fails every once in a while when the servers go down and back up and the bot hangs on logon). I like this approach because I like being able to open screen and see the current output of the bot. However, this requires you to have a user logged in.

It should be pretty easy to create a script to start Budabot and then copy it to /etc/init.d. Then you can set the runlevel for that service so that it starts when the server starts, without requiring a user to be logged in. The exact steps for this are different depending on which flavor of *nix you use (see here for ubuntu instructions/example: https://askubuntu.com/questions/9382/ho ... at-startup).

Another option I have been experimenting with is to run Budabot inside of a Docker container. If you are familiar with Docker and already have facilities setup for running docker containers as services, this would be a good option. But if not, getting that all setup might be more trouble than it's worth.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Krause
Member
Posts: 2
Joined: Tue Aug 22, 2017 7:00 am

Re: How To: Budabot on Linux

Postby Krause » Wed Aug 23, 2017 3:03 am

I tried this systemd method to no avail. Named it budadbot.service in systemd/system, starting it manually didn't throw an error, but the bot never came online and I can't see any output from the bots terminal window to know what happened.

Code: Select all

[Unit]
Description=Budabot
After=network.target

[Service]
User=myname
Group=myname
ExecStart=/home/myname/Budabot/chatbot.sh

[Install]
WantedBy=multi-user.target


If I can't figure that out then autologin might be the way to go. If I autologin and have it run using screen, would I be able to call that screen if I SSH in as that running user? That would actually be pretty awesome.


[EDIT]
Woooo! Did it!

Needed working directory!

This was done on my Ubuntu 17.04 system, systemd location might be different on other distros.

Code: Select all

sudo nano /etc/systemd/system/Budabot.service


And enter something like:

Code: Select all

[Unit]
Description=Budabot
After=network.target

[Service]
User=myname
Group=myname
WorkingDirectory=/home/myname/Budabot
ExecStart=/home/myname/Budabot/chatbot.sh

[Install]
WantedBy=multi-user.target
(replace "myname" with whatever user/group you want running it. I kept it simple and ran it as my user account and from my home directory)


You can test it with:

Code: Select all

sudo service Budabot start


And you can set it to run at start with:

Code: Select all

sudo systemctl enable Budabot


Systemd logs all output, so while you cant actually see the terminal you can access that services current log to see what would of been in the terminal up to that point, which is pretty cool. The command for that is:

Code: Select all

sudo journalctl -u Budabot.service


And now my bot runs before I even log in :D This will be perfect for that tiny no GUI linux server now.

I would like to modify it so that there is an execstop command so that I can restart the bot without rebooting though, any ideas on what I could put in as a command to stop the bot for execstop?
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: How To: Budabot on Linux

Postby Tyrence » Wed Aug 23, 2017 7:23 am

Very nice :)

I'm not sure what to put in for execstop. The only thing I can think of is something like

Code: Select all

kill $(ps aux | grep 'budabot' | awk '{print $2}')
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Nitrinax
Member
Posts: 5
Joined: Wed Aug 09, 2017 7:25 am

Re: How To: Budabot on Linux

Postby Nitrinax » Fri Aug 25, 2017 6:59 am

the shorter version is

Code: Select all

kill all budabot
But this should not used if you have more than one bots running.
twist3ed
Member
Posts: 24
Joined: Mon Nov 26, 2012 3:45 am
Location: IA

Re: How To: Budabot on Linux

Postby twist3ed » Sat Sep 09, 2017 2:50 am

Followed your guide except I used php 7.0 vs 5 but I'm getting this error now.

Code: Select all

Sat Sep  9 02:48:30 2017 INFO StartUp - Starting Furybot (3.4_GA) on RK5...
Sat Sep  9 02:48:30 2017 INFO ClassLoader - Loading CORE modules...
Sat Sep  9 02:48:30 2017 INFO ClassLoader - Loading USER modules...
Sat Sep  9 02:48:33 2017 ERROR SQL - Error loading sql file 'trickle.sql': Unknown table 'budabot.trickle' in: DROP TABLE trickle; - Array
(
)

Sat Sep  9 02:48:34 2017 INFO Budabot - Connecting to AO Server...(chat.d1.funcom.com:7105)
Sat Sep  9 02:48:34 2017 INFO Budabot - Authenticate login data...

Fatal error: Uncaught Error: Call to undefined function Budabot\Core\bccomp() in /home/budabot/Budabot3.4_GA/core/AOChat.class.php:689
Stack trace:
#0 /home/budabot/Budabot3.4_GA/core/AOChat.class.php(775): Budabot\Core\AOChat->ReduceTo32Bit(3738418151)
#1 /home/budabot/Budabot3.4_GA/core/AOChat.class.php(757): Budabot\Core\AOChat->aochat_crypt('5e016b8349ea4a1...', '\xE7\xBB\xD3\xDE\xA9\x9AX\xE3\x00\x00\x004rat...')
#2 /home/budabot/Budabot3.4_GA/core/AOChat.class.php(298): Budabot\Core\AOChat->generate_login_key('58b0ed1b9c04c94...', 'LOGINREMOVED', 'LOGINREMOVED')
#3 /home/budabot/Budabot3.4_GA/core/Budabot.class.php(171): Budabot\Core\AOChat->authenticate('LOGINREMOVED', 'LOGINREMOVED')
#4 /home/budabot/Budabot3.4_GA/core/BotRunner.php(83): Budabot\Core\Budabot->connectAO('LOGINREMOVED', 'LOGINREMOVED', 'chat.d1.funcom....', 7105)
#5 /home/budabot/Budabot3.4_GA/main.php(6): Budabot\Core\BotRunner->run()
#6 {main}
  thrown in /home/budabot/Budabot3.4_GA/core/AOChat.class.php on line 689
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: How To: Budabot on Linux

Postby Tyrence » Sat Sep 09, 2017 9:24 am

This is what I install for PHP:

Code: Select all

apt-get -y install php php-mbstring php-curl php-xml php-mysql php-sqlite3 php-bcmath
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: How To: Budabot on Linux

Postby Tyrence » Sat Sep 09, 2017 9:25 am

This is what I install for PHP 7 on Ubuntu 16.04:

Code: Select all

apt-get -y install php php-mbstring php-curl php-xml php-mysql php-sqlite3 php-bcmath
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest