-
Notifications
You must be signed in to change notification settings - Fork 0
/
ukasaexamples.tar
31 lines (24 loc) · 2.5 KB
/
ukasaexamples.tar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
examples/nodemon.sh 0000666 0000000 0000000 00000001364 14557743426 013523 0 ustar admin root #!/bin/sh
# nodemon - make sure an AiMesh node is on-line.
#
# if a node (or any network device plugged into a Kasa plug) doesn't respond
# power cycle it - and hope for the best ;-)
#
# I would invoke this from cron, running something like every 15 mins by adding
# this line to services-start (changing the IP address to the nodes)
#
# cru a NodeMon "*/15 * * * * sh /jffs/scripts/nodemon.sh 192.168.1.7"
if ! ping -q -c 2 -W 2 $1 >/dev/null; then
/jffs/scripts/ukasa $1 off
sleep 5
/jffs/scripts/ukasa $1 on
logger -t "nodemon" "Power cycled Node $1"
# ideally send an email when cycled
echo "Node $1 was power cycled" > /tmp/mail1.txt
date >> /tmp/mail1.txt
echo >> /tmp/mail1.txt
#
# insert favorite method to send an email here
#
fi