One issue seems to be that processes, start and stop differently when I use different methods.
The first method is the "Mageia Control Center" - "Manage System Services".
The second method is the command line usage of the systemctl command.
The important lines of the systemd unit files for the nut services are:
- Code: Select all
[hank@HIvyTower system]$ pwd
/usr/lib/systemd/system
[hank@HIvyTower system]$ grep -v -e "^#" -e "^\$" nut-* | grep -e ":After" -e ":Before" -e ":Requires" -e ":ExecSt" -e ":Stop" | more
nut-driver.service:After=local-fs.target network.target
nut-driver.service:StopWhenUnneeded=yes
nut-driver.service:ExecStart=/sbin/upsdrvctl start
nut-driver.service:ExecStop=/sbin/upsdrvctl stop
nut-monitor.service:After=local-fs.target network.target nut-server.service
nut-monitor.service:ExecStartPre=-/usr/bin/systemd-tmpfiles --create /lib/tmpfiles.d/nut-client.conf
nut-monitor.service:ExecStart=/usr/sbin/upsmon
nut-server.service:After=local-fs.target network.target nut-driver.service
nut-server.service:Requires=nut-driver.service
nut-server.service:Before=nut-monitor.service
nut-server.service:ExecStart=/usr/sbin/upsd
[hank@HIvyTower system]
I can start the nut driver from the Mageia Control Center, and it will continue to run without the other nut services running.
But the unit file says to stop the nut-driver when it is not needed, and only the nut-server says it will need it.
If I use the command line to start the nut-driver, it will start, and stop because nothing needs it. Like so:
- Code: Select all
[hank@HIvyTower ~]$ sudo systemctl start nut-driver
[sudo] password for hank:
[hank@HIvyTower ~]$ ps -ef | grep -v -e grep -e cups | grep -i -e nut -e ups
[hank@HIvyTower ~]$ sudo systemctl status nut-driver
nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/usr/lib/systemd/system/nut-driver.service; static)
Active: inactive (dead)
May 04 01:49:31 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.
May 04 01:49:31 HIvyTower systemd[1]: Stopping Network UPS Tools - power device driver controller...
May 04 01:49:31 HIvyTower usbhid-ups[15067]: Startup successful
May 04 01:49:31 HIvyTower upsdrvctl[15071]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Using subdriver: CyberPower HID 0.3
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Network UPS Tools - Generic HID driver 0.37 (2.6.5)
May 04 01:49:31 HIvyTower upsdrvctl[15061]: USB communication driver 0.31
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:49:33 HIvyTower usbhid-ups[15067]: Signal 15: exiting
May 04 01:49:33 HIvyTower systemd[1]: Stopped Network UPS Tools - power device driver controller.
[hank@HIvyTower ~]
If I start the nut-server using the CLI, then all three services are started, and continue to run. See:
- Code: Select all
[hank@HIvyTower ~]$ sudo systemctl start nut-server
[hank@HIvyTower ~]$ sudo systemctl status nut-driver
nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/usr/lib/systemd/system/nut-driver.service; static)
Active: active (running) since Mon 2015-05-04 01:58:10 CDT; 8s ago
Process: 15830 ExecStop=/sbin/upsdrvctl stop (code=exited, status=0/SUCCESS)
Process: 15865 ExecStart=/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
Main PID: 15871 (usbhid-ups)
CGroup: /system.slice/nut-driver.service
└─15871 /sbin/usbhid-ups -a HbiLinTower
May 04 01:58:10 HIvyTower systemd[1]: Starting Network UPS Tools - power device driver controller...
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Using subdriver: CyberPower HID 0.3
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Network UPS Tools - Generic HID driver 0.37 (2.6.5)
May 04 01:58:10 HIvyTower upsdrvctl[15865]: USB communication driver 0.31
May 04 01:58:10 HIvyTower usbhid-ups[15871]: Startup successful
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:58:10 HIvyTower systemd[1]: Started Network UPS Tools - power device driver controller.
[hank@HIvyTower ~]$ sudo systemctl start nut-server
[hank@HIvyTower ~]$ sudo systemctl status nut-server
nut-server.service - Network UPS Tools - power devices information server
Loaded: loaded (/usr/lib/systemd/system/nut-server.service; disabled)
Active: active (running) since Mon 2015-05-04 01:58:10 CDT; 37s ago
Process: 15872 ExecStart=/usr/sbin/upsd (code=exited, status=0/SUCCESS)
Main PID: 15873 (upsd)
CGroup: /system.slice/nut-server.service
└─15873 /usr/sbin/upsd
May 04 01:58:10 HIvyTower upsd[15872]: fopen /var/state/ups/upsd.pid: No such file or directory
May 04 01:58:10 HIvyTower upsd[15872]: listening on 127.0.0.1 port 3493
May 04 01:58:10 HIvyTower upsd[15872]: /var/state/ups is world readable
May 04 01:58:10 HIvyTower upsd[15872]: Connected to UPS [HbiLinTower]: usbhid-ups-HbiLinTower
May 04 01:58:10 HIvyTower upsd[15872]: listening on 127.0.0.1 port 3493
May 04 01:58:10 HIvyTower upsd[15872]: /var/state/ups is world readable
May 04 01:58:10 HIvyTower upsd[15872]: Connected to UPS [HbiLinTower]: usbhid-ups-HbiLinTower
May 04 01:58:10 HIvyTower upsd[15873]: Startup successful
May 04 01:58:10 HIvyTower systemd[1]: Started Network UPS Tools - power devices information server.
May 04 01:58:36 HIvyTower systemd[1]: Started Network UPS Tools - power devices information server.
[hank@HIvyTower ~]$ sudo systemctl status nut-monitor
nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
Loaded: loaded (/usr/lib/systemd/system/nut-monitor.service; disabled)
Active: active (running) since Mon 2015-05-04 01:55:50 CDT; 3min 9s ago
Process: 15701 ExecStart=/usr/sbin/upsmon (code=exited, status=0/SUCCESS)
Process: 15699 ExecStartPre=/usr/bin/systemd-tmpfiles --create /lib/tmpfiles.d/nut-client.conf (code=exited, status=0/SUCCESS)
Main PID: 15705 (upsmon)
CGroup: /system.slice/nut-monitor.service
├─15704 /usr/sbin/upsmon
└─15705 /usr/sbin/upsmon
May 04 01:57:35 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:40 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:45 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:50 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:55 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:00 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:05 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:10 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:15 HIvyTower upsmon[15705]: Login on UPS [HbiLinTower@localhost] failed - got [ERR ACCESS-DENIED]
May 04 01:58:20 HIvyTower upsmon[15705]: Communications with UPS HbiLinTower@localhost established
[hank@HIvyTower ~]
Here are the processes finally running:
- Code: Select all
[hank@HIvyTower ~]$ ps -ef | grep -v -e grep -e cups | grep -i -e nut -e ups
root 15704 1 0 01:55 ? 00:00:00 /usr/sbin/upsmon
ups 15705 15704 0 01:55 ? 00:00:00 /usr/sbin/upsmon
ups 15871 1 0 01:58 ? 00:00:00 /sbin/usbhid-ups -a HbiLinTower
ups 15873 1 0 01:58 ? 00:00:00 /usr/sbin/upsd
[hank@HIvyTower ~]
My answer to my original question is: The usbhid-ups process is nut-driver service. The upsd process is the nut-server service. And the upsmon processes in the nut-monitor service.
Regardless, I seem to need all three running on my system.