diff --git a/rowbot b/rowbot index 47d356f..0bed97d 100755 --- a/rowbot +++ b/rowbot @@ -379,18 +379,43 @@ on_sys_exit_998_net() { } ### -# irc magic (everything required to make the bot part of rowbot functional) +# annoyatron900 - keep alive process ### -magic_annoyatron900() { +annoyatron900() { irc_ping "row your bot gently down the stream" } -on_sys_init_999_magic() { - get_option chan "" +on_sys_before_999_annoyatron900() { + if [[ -v alarm_pid ]]; then + export ALARM_PID=$alarm_pid + fi } -on_sys_first_003_magic() { +on_sys_after_999_annoyatron900() { + trap annoyatron900 USR1 + + if [[ -v ALARM_PID ]]; then + alarm_pid=$ALARM_PID + fi +} + +on_sys_register_999_annoyatron900() { + while true; do + read -rt 10