diff --git a/.cfg.example b/.cfg.example new file mode 100644 index 0000000..3a50fdb --- /dev/null +++ b/.cfg.example @@ -0,0 +1,16 @@ +SERVER=localhost # the IRC server to connect to +PASS= # server pass +PORT=6667 # port to connect to +NICK=sedbot # bot's nickname +LOGIN=sedbot # bot's username +REALNAME=sedbot # bot's name +CHANNELS=('#meta', '#team', '#yourtilde') # array of channels to autojoin at start +IRC_LOG=sedbot.log # irc message log +ERROR_LOG=sedbot.err # log of errors, events and used regexps + +MAX_LINE_LENGTH=400 # truncate lines to this many bytes +SLEEP_JOIN=3 # sleep after identifying before autojoining channels +SLEEP_RECONNECT=10 # sleep before reconnecting on disconnect +READ_TIMEOUT=300 # seconds before reconnect if no line is read +ACCEPT_INVITES=1 # 0 to ignore invites + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e71a4f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.cfg diff --git a/sedbot.bash b/sedbot.bash index 71b1a9b..2cb07e6 100755 --- a/sedbot.bash +++ b/sedbot.bash @@ -2,26 +2,8 @@ #sedbot: a regex IRC bot in bash and sed #license: GNU GPL v3+ - -SERVER=localhost # the IRC server to connect to -PASS= # server pass -PORT=6667 # port to connect to -NICK=sedbot # bot's nickname -LOGIN=sedbot # bot's username -REALNAME=sedbot # bot's name -CHANNELS=('#meta', '#team', '#yourtilde') # array of channels to autojoin at start -IRC_LOG=sedbot.log # irc message log -ERROR_LOG=sedbot.err # log of errors, events and used regexps - -MAX_LINE_LENGTH=400 # truncate lines to this many bytes -SLEEP_JOIN=3 # sleep after identifying before autojoining channels -SLEEP_RECONNECT=10 # sleep before reconnecting on disconnect -READ_TIMEOUT=300 # seconds before reconnect if no line is read -ACCEPT_INVITES=1 # 0 to ignore invites - - -############################################################################### - +# source configs +. .cfg exec 4> >(tee -a -- "$IRC_LOG") 2> >(tee -a -- "$ERROR_LOG" >&2) diff --git a/sedbot.service b/sedbot.service new file mode 100644 index 0000000..5228a4e --- /dev/null +++ b/sedbot.service @@ -0,0 +1,16 @@ +[Unit] +Description=irc sedbot +After=sedbot.service + +[Service] +Type=simple +WorkingDirectory=/home/bot/sedbot +ExecStart=./sedbot.bash +Restart=always +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +[Install] +WantedBy=default.target +