diff --git a/bin/auto b/bin/auto index 9884736..68c2690 100755 --- a/bin/auto +++ b/bin/auto @@ -476,6 +476,16 @@ while (1) { err(2, "Lost connection to $sockid!", 0); $SELECT->remove($sock); delete $SOCKET{$sockid}; + if (!keys %SOCKET) { + # No more connections, stop the program. + $Auto::DB->disconnect; + API::Std::event_run('on_shutdown'); + if (-e "$Bin/auto.pid") { unlink "$Bin/auto.pid"; } + dbug '* No more IRC connections, shutting down.'; + alog '* No more IRC connections, shutting down.'; + sleep 1; + exit; + } next; } diff --git a/doc/CHANGELOG b/doc/CHANGELOG index dd89205..c2b3626 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Shutdown if there are no more IRC connections. * Added the ability to use printf(3) % variables in trans(). * Added slog() to API::Log for logging to IRC. * Added a Greet module for greeting users on join.