nutNotifyShutdown use fct and update readme
This commit is contained in:
@@ -1,3 +1,31 @@
|
|||||||
# nutNotify
|
# nutNotify
|
||||||
script to speak to your UPS with different notifications : mail push sms.
|
Script to be notified by your UPS with differents notifications :
|
||||||
|
- mail
|
||||||
|
- Telegram
|
||||||
|
- pushbullet
|
||||||
|
- SMS
|
||||||
|
|
||||||
|
## Install
|
||||||
|
- Copy git
|
||||||
|
- Copy file `nutNotify.conf.txt` to `/usr/local/etc/nutNotify.conf` and edit it
|
||||||
|
- Copy `nutNotifyFct.sh nutNotifyBoot.sh nutNotify.sh nutShutdown.sh` to `/usr/local/bin`
|
||||||
|
- Copy `systemd-notify` to `/lib/systemd/system/nut-notify-boot.service`
|
||||||
|
- systemctl reload daemon and enable `nut-notify-boot`
|
||||||
|
- Create folder `/var/log/nutNotify` with nut rights
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/belgotux/nutNotify.git
|
||||||
|
cd nutNotify
|
||||||
|
cp nutNotify.conf.txt /usr/local/etc/nutNotify.conf
|
||||||
|
vim /usr/local/etc/nutNotify.conf
|
||||||
|
cp nutNotifyFct.sh nutNotifyBoot.sh nutNotify.sh nutShutdown.sh /usr/local/bin
|
||||||
|
cp systemd-notify /lib/systemd/system/nut-notify-boot.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable nut-notify-boot.service
|
||||||
|
mkdir /var/log/nutNotify
|
||||||
|
chown nut:nut /var/log/nutNotify
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Link
|
||||||
See this article for more informations (in french) : https://www.monlinux.net/2018/03/nut-ups-notifications-mails-et-arret/
|
See this article for more informations (in french) : https://www.monlinux.net/2018/03/nut-ups-notifications-mails-et-arret/
|
||||||
|
|||||||
+6
-14
@@ -2,23 +2,15 @@
|
|||||||
# Auteur : Belgotux
|
# Auteur : Belgotux
|
||||||
# Site : www.monlinux.net
|
# Site : www.monlinux.net
|
||||||
# Licence : GPLV3
|
# Licence : GPLV3
|
||||||
# Version : 1.0
|
# Version : 1.1
|
||||||
# Date : 08/04/2012
|
# Date : 08/04/2012
|
||||||
|
# Update : 04/01/2023
|
||||||
|
|
||||||
# Variables
|
# variables
|
||||||
logfile=/var/log/nutNotify/nutNotify.log #logfile for nutNotify
|
configFile=/usr/local/etc/nutNotify.conf
|
||||||
flagfile=/var/log/nutNotify/nutShutdown.flag
|
|
||||||
|
|
||||||
#add to log
|
source "$configFile"
|
||||||
function addLog {
|
source "$(dirname $0)/nutNotifyFct.sh"
|
||||||
if [ "$logfile" == "" ] ; then
|
|
||||||
echo "Can't write to log !" 1>&2
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
echo "$(date +'%a %d %H:%M:%S') $1" >> $logfile
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
addLog "poweroff $HOSTNAME"
|
addLog "poweroff $HOSTNAME"
|
||||||
|
|||||||
Reference in New Issue
Block a user