Doorcam: Difference between revisions
Jump to navigation
Jump to search
(Created page with "* axis dome at frontdoor * monitored by the following cron-entry on 'librenms' ** */15 * * * * /usr/local/bin/ping-door-cam.sh ==== /usr/local/bin/ping-door-cam.sh ==== <nowiki>#! /bin/sh ping -c 1 -q 10.208.0.22 > /dev/null if [ $? -ne 0 ] ; then /usr/bin/mosquitto_pub -h mqtt.vm.nurd.space -t 'GHBot/to/irc/nurdsbofh/privmsg' -m 'Door camera down?' /usr/local/bin/reboot-door-cam /usr/bin/mosquitto_pub -h mqtt.vm.nurd.space -t 'GHBot/to/irc/nurdsbofh/privmsg'...") |
(No difference)
|
Revision as of 17:27, 4 October 2024
- axis dome at frontdoor
- monitored by the following cron-entry on 'librenms'
- */15 * * * * /usr/local/bin/ping-door-cam.sh
/usr/local/bin/ping-door-cam.sh
#! /bin/sh ping -c 1 -q 10.208.0.22 > /dev/null if [ $? -ne 0 ] ; then /usr/bin/mosquitto_pub -h mqtt.vm.nurd.space -t 'GHBot/to/irc/nurdsbofh/privmsg' -m 'Door camera down?' /usr/local/bin/reboot-door-cam /usr/bin/mosquitto_pub -h mqtt.vm.nurd.space -t 'GHBot/to/irc/nurdsbofh/privmsg' -m 'Door camera rebooted' fi
reboot-door-cam
#!/usr/bin/env bash
CMDFILE="$(mktemp)"
chmod 0644 ${CMDFILE}
cat > ${CMDFILE} <<EOF
conf t
int Gi1/0/14
power inline never
EOF
sudo -u rancid clogin -x "${CMDFILE}" poe-sw
rm ${CMDFILE}
sleep 1
CMDFILE="$(mktemp)"
chmod 0644 ${CMDFILE}
cat > ${CMDFILE} <<EOF
conf t
int Gi1/0/14
power inline auto
EOF
sudo -u rancid clogin -x "${CMDFILE}" poe-sw
rm ${CMDFILE}