Compare commits
No commits in common. "0060552aba2c84c68ed01cec555a670e001f2a51" and "4b6e8af69ea51ca367f8bfcd117c26fe24578ea8" have entirely different histories.
0060552aba
...
4b6e8af69e
4
Makefile
4
Makefile
@ -8,14 +8,14 @@ SYSTEMD_UNIT_DIR = /lib/systemd/system
|
|||||||
|
|
||||||
rc: install
|
rc: install
|
||||||
@echo installing ircbot to /etc/rc.d
|
@echo installing ircbot to /etc/rc.d
|
||||||
@cp -f services/rc/ircbot /etc/rc.d
|
@cf -f services/rc/ircbot /etc/rc.d
|
||||||
@echo enabling ircbot
|
@echo enabling ircbot
|
||||||
@rcctl enable ircbot
|
@rcctl enable ircbot
|
||||||
@echo not starting ircbot -- configure it then run `rcctl start ircbot` as root
|
@echo not starting ircbot -- configure it then run `rcctl start ircbot` as root
|
||||||
|
|
||||||
systemd: install
|
systemd: install
|
||||||
@echo installing ircbot.service to ${SYSTEMD_UNIT_DIR}
|
@echo installing ircbot.service to ${SYSTEMD_UNIT_DIR}
|
||||||
@cp -f services/systemd/ircbot.service ${SYSTEMD_UNIT_DIR}
|
@cf -f services/systemd/ircbot.service ${SYSTEMD_UNIT_DIR}
|
||||||
@echo enabling ircbot.service
|
@echo enabling ircbot.service
|
||||||
@systemctl enable ircbot.service
|
@systemctl enable ircbot.service
|
||||||
@echo not starting ircbot.service -- configure it then run `systemctl start ircbot.service` as root
|
@echo not starting ircbot.service -- configure it then run `systemctl start ircbot.service` as root
|
||||||
|
18
ircbot.sh
18
ircbot.sh
@ -3,8 +3,6 @@
|
|||||||
# TODO: make sure only nagios can write to $inputf and $msgf, else do not run
|
# TODO: make sure only nagios can write to $inputf and $msgf, else do not run
|
||||||
|
|
||||||
# configuration area
|
# configuration area
|
||||||
# TODO: separate configuration into a file owned by nagios user.
|
|
||||||
# this improves security and allows reinstall (from git) to not clobber config.
|
|
||||||
nick='nagios'
|
nick='nagios'
|
||||||
chan='#ops'
|
chan='#ops'
|
||||||
server='irc.anarchyplanet.org'
|
server='irc.anarchyplanet.org'
|
||||||
@ -19,14 +17,14 @@ joinmsg="nagios bot reporting"
|
|||||||
touch $msgf
|
touch $msgf
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
echo "NICK $nick" > $inputf
|
echo "NICK $nick" > $inputf
|
||||||
echo "USER $nick 8 * : $nick" >> $inputf
|
echo "USER $nick 8 * : $nick" >> $inputf
|
||||||
echo "PRIVMSG NickServ : identify $password" >> $inputf
|
echo "PRIVMSG NickServ : identify $password" >> $inputf
|
||||||
echo "JOIN $chan" >> $inputf
|
echo "JOIN $chan" >> $inputf
|
||||||
echo "PRIVMSG $chan : $joinmsg" >> $inputf
|
echo "PRIVMSG $chan : $joinmsg" >> $inputf
|
||||||
}
|
}
|
||||||
reconnect() {
|
reconnect() {
|
||||||
exec $0
|
exec $0
|
||||||
}
|
}
|
||||||
delay() {
|
delay() {
|
||||||
while read line
|
while read line
|
||||||
@ -63,7 +61,7 @@ do
|
|||||||
;;
|
;;
|
||||||
*'Cannot join'*) sleep 10; echo "JOIN $chan" >> $inputf
|
*'Cannot join'*) sleep 10; echo "JOIN $chan" >> $inputf
|
||||||
;;
|
;;
|
||||||
*'ERROR :Closing link:'*) reconnect
|
*'ERROR :Closing link:'*) reconnect
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user