add systemd unit and config file

pull/3/head
Ben Harris 2019-03-30 17:50:14 -04:00
parent 0e2f92bd3d
commit b6ad48e079
4 changed files with 35 additions and 20 deletions

16
.cfg.example 100644
View File

@ -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

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
.cfg

View File

@ -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)

16
sedbot.service 100644
View File

@ -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