- Κώδικας: Επιλογή όλων
#!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# goes on batteries.
#
SYSADMIN=gvoulgarg@gmail.com
APCUPSD_MAIL="/usr/bin/sendemail"
HOSTNAME=`hostname`
MSG="Μόλις ενεργοποιήθηκε το UPS γιατί κόπηκε το ρεύμα στον υπολογιστή του Διστράτου"
#
(
echo " "
echo " ====================================="
echo " POWER FAILURE ON $HOSTNAME !!"
echo " ====================================="
echo " "
echo " The UPS on your Ubuntu PC has experienced a power problem that has required the UPS to engage battery mode."
echo " "
echo " Do not panic! Remain calm..."
echo " "
echo "Current UPS status:"
echo " "
/sbin/apcaccess status
) | sendEmail -f gvoulgarg@gmail.com -t gvoulgarg@gmail.com -u "UPS Δίστρατο" -m "$MSG" -s smtp.gmail.com:25 -xu gvoulgarg -xp gvoulgarg_account_passwd
exit 0
- Κώδικας: Επιλογή όλων
sh /etc/apcupsd/onbattery
Δοκιμή στο Desktop και το email φτάνει στον παραλήπτη
Δοκιμή στο Server και δίνει σφάλμα * έχω κάνει εγκατάσταση το πακέτο sendemail
- Κώδικας: Επιλογή όλων
blades@ubuntu-distrato:~$ sh /etc/apcupsd/onbattery
May 17 15:29:37 ubuntu-distrato sendEmail[2122]: NOTICE => Authentication not supported by the remote SMTP server!
May 17 15:29:37 ubuntu-distrato sendEmail[2122]: ERROR => Received: 530 5.7.0 Must issue a STARTTLS command first. i3sm18432994eev.1 - gsmtp


