<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
Thanks, Roger, I thought I was replying to the list, but apparently
not. So perhaps this will help someone else who has a similar
situation.<br>
I wasn't clear enough in my initial question...it isn't so much that
I want the status of the UPS, rather I want to know that the Pi is
operational again after upsmon has shutdown the Pi and then the UPS
has had power restored to it.<br>
I created a script called "reboot_notify" and saved it in
usr/local/bin, and it looks like this:<br>
<br>
#!/bin/sh<br>
echo “Rpi has booted into operation” | mail -s "Alert from
Peppermill RPi" [my email address]<br>
echo "Rpi has booted into operation" | mail -s "Alert from
Peppermill RPi" [email address for text messages]<br>
<br>
I read that scripts placed in "rc.local" get run at boot, so I
edited /etc/rc.local like this<br>
<br>
#!/bin/sh -e<br>
#<br>
# rc.local<br>
#<br>
# This script is executed at the end of each multiuser runlevel.<br>
# Make sure that the script will "exit 0" on success or any other<br>
# value on error.<br>
#<br>
# In order to enable or disable this script just change the
execution<br>
# bits.<br>
#<br>
# By default this script does nothing.<br>
<br>
# Print the IP address<br>
<b><font color="#ff0080"><br>
# Have the system pause while all the mail elements load,<br>
sleep 60<br>
# and then run the script:<br>
sudo /usr/local/bin/reboot_notify<br>
</font></b><br>
_IP=$(hostname -I) || true<br>
if [ "$_IP" ]; then<br>
printf "My IP address is %s\n" "$_IP"<br>
fi<br>
<br>
exit 0<br>
<br>
Then I made the file executable <br>
<br>
<span style="color: rgb(85, 85, 85); font-family: Roboto, Arial,
Helvetica, sans-serif; font-size: 14.3px; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
start; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
0px; background-color: rgb(250, 250, 250);
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;">chmod +x /etc/rc.local<br>
<br>
To test it I ran <upsmon -c fsd> ; the Pi did an orderly
shutdown, the UPS turned off and then came back on again. A few
minutes later, after the Pi booted, I received a text message,
and the following email message:<br>
<br>
<br>
</span>"Alert from Peppermill Pi", "RPi has booted into operation".<br>
<br>
I'm sure there was probably a more-elegant way of doing that from a
programming standpoint, but for someone who didn't know the first
thing about Linux a month ago, I was pleased that I have a solution.<br>
<br>
Now I hope I didn't make some major mistake which de-stabilizes the
system 🙁<br>
<br>
<br>
</body>
</html>