You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
wm-bot is an IRC bot that participates in several developer-related wiki channels.
All stars team
These folks are currently operating the bot, please insert your name if you are one of us:
- Petr Bena User:Petrb petan on freenode
- Jeremyb User:jeremyb jeremyb on freenode
- Billinghurst User:Billinghurst sDrewth on freenode
- Thehelpfulone User:Thehelpfulone Thehelpfulone on freenode
- Matthew Bowker User:Matthewrbowker Matthew_ on freenode
- MacFan4000 User:MacFan4000 MacFan4000 on freenode
Where is it
Instance wm-bot.wm-bot.eqiad.wmflabs, you need root to operate the bot.
How does it work
Bot is using external bouncers. That means, you first start the bouncers, then you start restart script which keeps core running. The core is connected to bouncers, which are connected to network. In case you need to restart the core, bot stays connected to network.
This bot is using multiple instances but all are part of 1 huge system. The core handles all the instances but there is a bouncer for each of them.
|Binaries||/opt/wm-bot/wmib.exe - core|
How to start the bot
IMPORTANT: If the server has crashed and bot wasn't properly shut down you have to remove all pid files using
sudo rm -iv /mnt/share/wm-bot/*.pid
If bot isn't running you can start it using
sudo service wm-bot start
First of all, check what is already running:
ps -ef | grep wm-bot
If nothing is running, it should be ok, if some processes are there, kill them
- Ensure there are no *pid files in /mnt/share/wm-bot
- Make sure there is no restart.lock file
- There must be only 1 instance of core (restart.sh) running in same time
tail /mnt/share/wm-bot/wmib.log is your friend
How to restart the bot core (fixes most problems)
This is what you should do if you just want to fix some bot issues, this will restart the core only, bot will stay connected to all channels and this process is painless and quick. Preferred:
- tail /mnt/share/wm-bot/wmib.log there must be no critical errors! If you see that bot couldn't write log files etc, do not kill it, or these data will be permanently lost!
- join #wm-bot
- type @restart
If you get permission denied
You forgot to put your cloak to admins file, just ssh to wm-bot instance and kill process running as wm-bot called "mono wmib.exe". This process will restart itself when it crashes.
How to shutdown the bot
If you need to restart the bot because you changed the binaries and you need it to completely reload, you just need to execute "halt" or @restart in any channel. Keep in mind that doing restart after you changed the binary will likely fail (bot will crash instead of proper shutdown).
You can also shutdown the bot with signal (kill -15).
This command will also restart the bot, but it may not give it enough time to properly shut down (bot's proper shut down takes about 10 seconds)
sudo service wm-bot restart
How to fix 1 or more disconnected instances
Secret password is in /opt/wm-bot/configuration/admins (username is root) it's on first row third column
- Connect to local sysadmin console
$ telnet localhost 2020
- Now enter the username (root) and password
- Check the status (info / help)
Successfuly logged in to wm-bot info Uptime: 0 days 0 hours since 7/18/2013 11:53:39 AM Instances: wm-bot channels: 50 connected: True working: True wm-bot2 channels: 42 connected: True working: True
If you see that some instance is not working properly, no matter of status, shut it down:
Now, in second terminal, restart the corresponding bouncer, the bouncer is process bouncer.exe with parameter that correspond to broken instance, for example for wm-bot it's bouncer.exe 6667, list of all bouncers can be found at http://bots.wmflabs.org/~wm-bot/db/systemdata.htm
Once you kill that, you need start it again:
nohup mono bouncer.exe 6667 &
Once the bouncer is running again you need to connect bot to it, type this in system console:
How to change the logs
Recommended: In case you want to change logs, you must disable bot for that moment.
- Chmod the logfile with 000 (bot won't be able to write)
- Fix it and change the permissions back
- Connect to SQL database, using password in the
pg_pass=variable in the
root@wm-bot2:~# psql -h wm-bot-pg.eqiad.wmflabs wm-bot wm-bot
- Drop the logs for the given channel:
wm-bot=> delete from logs where channel='#mychannel';
How to patch the bot
that will recompile all source code in ../wikimedia-bot stop the bot, replace the binaries and start the bot