irc-bot icon indicating copy to clipboard operation
irc-bot copied to clipboard

Create a (shell/bash?) start script for the bot

Open Amunak opened this issue 10 years ago • 4 comments
trafficstars

The bot needs a start script that:

  • [ ] runs the bot in a loop in case it crashes so that it can get back up
  • [ ] listens for the bot's exit code and can detect:
    • proper shutdowns (initiated by, say, the !quit command) and end the loop
    • recoverable failure states (that just restart the bot)
    • unrecoverable failure states (that end the loop) - I'm not sure if we can differentiate between the two
    • proper restarts (using the !restart command and such)
  • [ ] optionally logs all of the bot's (console) output, or logs just the sessions where the bot errors out, etc.
  • [ ] can run the bot as a daemon
  • [ ] possibly tries to run the bot in a tmux or screen session (but I'm not sure if implementing this can be clean)

We don't need all of that, but a loop that can at least tell apart a !restart or crash/error/whatever and !quit would be really helpful.

We could also provide some init scripts or systemd unit files, but I don't think it's necessary.

Amunak avatar Feb 06 '15 00:02 Amunak

Possibly we can use this: https://github.com/reactphp/child-process for a PHP script. Systemd unit will be coming up in a bit. Although I'd personally prefer it if the system service manager did this and we didn't implement such thing on our own.

NanoSector avatar Jul 22 '17 12:07 NanoSector

Systemd service added as per https://github.com/WildPHP/Wild-IRC-Bot/commit/612878e880990aa1ffea1d22c14ffe5d54341b52

NanoSector avatar Jul 22 '17 13:07 NanoSector

I honestly think having a system service manager like systemd handle this is way more reliable than doing it ourselves. I'll leave this open for a while longer.

NanoSector avatar Aug 21 '17 21:08 NanoSector

The other solution is: https://github.com/eggheads/eggdrop/blob/develop/scripts/botchk https://github.com/eggheads/eggdrop/blob/develop/scripts/autobotchk

ivptr avatar Dec 27 '20 18:12 ivptr