Loaded: loaded (/lib/systemd/system/rvice enabled vendor preset: enabled)Īctive: active (running) since Fri 07:49:48 CEST 1min 8s ago rvice - Network UPS Tools - power device monitor and shutdown controller.You should see something similar: $ for S in rvice rvice rvice rvice do systemctl status $S -l done Wait few seconds to let them start then check their status: for S in rvice rvice rvice rvice do systemctl status $S -l done You can now restart all the nut related systemd services: for S in rvice rvice rvice rvice do sudo systemctl restart $S done Sudo sed -e 's/MODE=none/MODE=standalone/ ' -i /etc/nut/nut.conf We'll set it to the standalone mode for now. ![]() Now that we have defined the UPS in the /etc/nut/ups.conf file and the monitoring user in the /etc/nut/ers then finally set the monitoring connection in /etc/nut/nf, we must now change the running mode which is by default set to none and would not let systemd services to run correctly. # Comment out this line if it didn't worked with the 'upsc' command above # echo -e "AT ONLINE EXECUTE online\nAT ONBATT EXECUTE onbatt\nAT LOWBATT EXECUTE lowbatt" | sudo tee -a /etc/nut/nf # Check the result # Add commands defined in the scripts echo -e "\n# Custom commands " | sudo tee -a /etc/nut/nfĮcho -e "AT ONLINE $(upsc -l 2>/dev/null EXECUTE online\nAT ONBATT $(upsc -l 2>/dev/null EXECUTE onbatt\nAT LOWBATT $(upsc -l 2>/dev/null EXECUTE lowbatt " | sudo tee -a /etc/nut/nf Sudo sed -e 's|# LOCKFN /run/|LOCKFN /run/| ' -i /etc/nut/nf Sudo sed -e 's|# PIPEFN /run/|PIPEFN /run/| ' -i /etc/nut/nf Now that we have improved the existing commands scheduling scripts, we have to edit the /etc/nut/nf file and change or set some values: Logger -i -t upssched-cmd $MSG # Comment out the line below for workstations # notify-send-all "$MSG" Configure commands scheduling *) MSG= " $UPS, $CHMSG - Unrecognized command: $1 " Upsgone) MSG= "The UPS $UPS has been gone for awhile " Lowbatt) MSG= " $UPS, $CHMSG - shutdown now! " Onbatt) MSG= " $UPS, $CHMSG - power failure - save your work! " Online) MSG= " $UPS, $CHMSG - power supply has been restored. UPS= $( upsc -l 2>/dev/null ) # Or manual name assignement # UPS="YOUR-UPS-DEFINED-NAME-IN-UPS.CONF"ĬHMSG= ": $CHARGE% " case $1 in # The first argument passed to your CMDSCRIPT is the name of the timer # from your AT lines. # This script may be replaced with another program without harm. # Here is a quick example to show how to handle a bunch of possible # timer names with the help of the case structure. #! /bin/sh # This script should be called by upssched via the CMDSCRIPT directive. Now we have to add the generated connection string into the /etc/nut/nf file: sudo nano /etc/nut/nfĪfter the examples of the MONITOR section: $ echo -e "\nMONITOR 1 monitor $NUT_RAND_PW master\n" # Generate strong password (but avoid using special chars) export NUT_RAND_PW= $(pwgen -snc -B 128 | awk '\n\tupsmon master\n" | sudo tee -a /etc/nut/ers
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |