J'espère qu'il y aura une âme charitable, si quelqu'un a déjà rencontré ce problème ou peut simplement m'aider...
alors voilà le topo:
J'ai une debian 10 fraichement installée d'il y a quelques jours sur une vielle machine, sur laquelle un onduleur est branché en USB .
J'ai donc installé 'nut' qui permet de communiquer avec l'onduleur et de le gérer. Et jusque là, tout marche bien !
Mais ce que je veux, c'est inclure un script perso pour réagir à certains évenements. Si je lance mon script manuellement, ça fonctionne, pas de souci de ce côté là.
Mon problème est que mon script ne se lance pas et je ne trouve pas d'où ça vient, je ne relève pas d'erreur liée à ça dans les logs (peut-être quelqu'un en trouvera !)
Je me suis appuyé sur la doc de upsmon et upssched, du wiki debian https://wiki.debian-fr.xyz/Configurer_e ... r_avec_NUT et de ces tutos : https://vixepti.fr/adminsys/2018/02/09/ ... c-nut.html et https://www.trojanc.co.za/2019/03/31/gu ... -centos-7/
et voici ce dont je dispose, ce qui me semblait pertinent de partager (dites-moi si j'ai oublié qqchose !):
l'état des services:
Code : Tout sélectionner
~$ sudo systemctl status nut-server.service
● nut-server.service - Network UPS Tools - power devices information server
Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-04-13 01:16:40 CEST; 4min 8s ago
Process: 1874 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS)
Main PID: 1875 (upsd)
Tasks: 1 (limit: 4665)
Memory: 724.0K
CGroup: /system.slice/nut-server.service
└─1875 /lib/nut/upsd
avril 13 01:16:40 Buffy upsd[1874]: listening on 192.168.0.22 port 3493
avril 13 01:16:40 Buffy upsd[1874]: listening on 127.0.0.1 port 3493
avril 13 01:16:40 Buffy upsd[1874]: listening on 192.168.0.22 port 3493
avril 13 01:16:40 Buffy upsd[1874]: listening on 127.0.0.1 port 3493
avril 13 01:16:40 Buffy upsd[1874]: Connected to UPS [Eaton]: usbhid-ups-Eaton
avril 13 01:16:40 Buffy upsd[1874]: Connected to UPS [Eaton]: usbhid-ups-Eaton
avril 13 01:16:40 Buffy upsd[1875]: Startup successful
avril 13 01:16:40 Buffy systemd[1]: Started Network UPS Tools - power devices information server.
avril 13 01:16:48 Buffy upsd[1875]: User upsmon@127.0.0.1 logged into UPS [Eaton]
avril 13 01:16:48 Buffy upsd[1875]: User upsmon@192.168.0.22 logged into UPS [Eaton]
Code : Tout sélectionner
~$ sudo systemctl status nut-monitor.service
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-04-13 01:16:48 CEST; 4min 36s ago
Process: 1879 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
Main PID: 1881 (upsmon)
Tasks: 2 (limit: 4665)
Memory: 1.6M
CGroup: /system.slice/nut-monitor.service
├─1880 /lib/nut/upsmon
└─1881 /lib/nut/upsmon
avril 13 01:16:48 Buffy upsmon[1879]: Using power down flag file /etc/killpower
avril 13 01:16:48 Buffy upsmon[1880]: Startup successful
avril 13 01:16:48 Buffy systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: No such file or directory
avril 13 01:16:48 Buffy systemd[1]: nut-monitor.service: Supervising process 1881 which is not our child. We'll most likely not notice when it exits.
avril 13 01:16:48 Buffy systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
avril 13 01:16:48 Buffy upsmon[1881]: Init SSL without certificate database
avril 13 01:17:33 Buffy upsmon[1881]: UPS Eaton@127.0.0.1 on battery
avril 13 01:17:33 Buffy upsmon[1881]: UPS Eaton@192.168.0.22 on battery
avril 13 01:18:13 Buffy upsmon[1881]: UPS Eaton@127.0.0.1 on line power
avril 13 01:18:13 Buffy upsmon[1881]: UPS Eaton@192.168.0.22 on line power
Code : Tout sélectionner
~$ sudo grep -E "(ups|nut)" /var/log/syslog
Apr 13 01:16:30 Buffy systemd[1]: nut-driver.service: Succeeded.
Apr 13 01:16:38 Buffy upsdrvctl[1871]: Using subdriver: MGE HID 1.39
Apr 13 01:16:38 Buffy upsdrvctl[1871]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Apr 13 01:16:38 Buffy upsdrvctl[1871]: USB communication driver 0.33
Apr 13 01:16:40 Buffy upsdrvctl[1871]: Network UPS Tools - UPS driver controller 2.7.4
Apr 13 01:16:40 Buffy usbhid-ups[1873]: Startup successful
Apr 13 01:16:40 Buffy upsd[1874]: fopen /var/run/nut/upsd.pid: No such file or directory
Apr 13 01:16:40 Buffy upsd[1874]: listening on 192.168.0.22 port 3493
Apr 13 01:16:40 Buffy upsd[1874]: listening on 127.0.0.1 port 3493
Apr 13 01:16:40 Buffy upsd[1874]: listening on 192.168.0.22 port 3493
Apr 13 01:16:40 Buffy upsd[1874]: listening on 127.0.0.1 port 3493
Apr 13 01:16:40 Buffy upsd[1874]: Connected to UPS [Eaton]: usbhid-ups-Eaton
Apr 13 01:16:40 Buffy upsd[1874]: Connected to UPS [Eaton]: usbhid-ups-Eaton
Apr 13 01:16:40 Buffy upsd[1875]: Startup successful
Apr 13 01:16:48 Buffy upsmon[1879]: fopen /var/run/nut/upsmon.pid: No such file or directory
Apr 13 01:16:48 Buffy upsmon[1879]: UPS: Eaton@127.0.0.1 (master) (power value 1)
Apr 13 01:16:48 Buffy upsmon[1879]: UPS: Eaton@192.168.0.22 (master) (power value 1)
Apr 13 01:16:48 Buffy upsmon[1879]: Using power down flag file /etc/killpower
Apr 13 01:16:48 Buffy upsmon[1880]: Startup successful
Apr 13 01:16:48 Buffy systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: No such file or directory
Apr 13 01:16:48 Buffy systemd[1]: nut-monitor.service: Supervising process 1881 which is not our child. We'll most likely not notice when it exits.
Apr 13 01:16:48 Buffy upsmon[1881]: Init SSL without certificate database
Apr 13 01:16:48 Buffy upsd[1875]: User upsmon@127.0.0.1 logged into UPS [Eaton]
Apr 13 01:16:48 Buffy upsd[1875]: User upsmon@192.168.0.22 logged into UPS [Eaton]
Apr 13 01:17:33 Buffy upsmon[1881]: UPS Eaton@127.0.0.1 on battery
Apr 13 01:17:33 Buffy upsmon[1881]: UPS Eaton@192.168.0.22 on battery
Apr 13 01:18:13 Buffy upsmon[1881]: UPS Eaton@127.0.0.1 on line power
Apr 13 01:18:13 Buffy upsmon[1881]: UPS Eaton@192.168.0.22 on line power
Code : Tout sélectionner
~$ sudo grep -Evr "^ *$|^ *#" /etc/nut/upsmon.conf
RUN_AS_USER nut
MONITOR Eaton@127.0.0.1 1 monuser monmdp master
MONITOR Eaton@192.168.0.22 1 monuser monmdp master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
Code : Tout sélectionner
~$ sudo grep -Evr "^ *$|^ *#" /etc/nut/upssched.conf
CMDSCRIPT /usr/local/nut/UPScountdown.sh
PIPEFN /usr/local/nut/upssched/upssched.pipe
LOCKFN /usr/local/nut/upssched/upssched.lock
AT ONBATT Eaton EXECUTE firstalert
AT ONLINE Eaton EXECUTE endofalert
AT LOWBATT Eaton EXECUTE lowlevelalert
AT SHUTDOWN Eaton EXECUTE criticalcall
Code : Tout sélectionner
~$ sudo ls -la /usr/local/nut/
total 16
drwxr-x--- 3 root nut 4096 avril 12 21:47 .
drwxr-xr-x 11 root root 4096 avril 12 17:30 ..
-rwxr-x--- 1 nut nut 1499 avril 12 21:47 UPScountdown.sh
drwxrwsr-x 2 root nut 4096 avril 12 21:47 upssched
Merci beaucoup à tout ceux qui liront ce message