Linux (NUT One-Click Script)
WalleCube provides setup-nut.sh, an official one-click script built on top of NUT (Network UPS Tools) — the most widely used open-source UPS management framework, supporting thousands of devices with built-in network monitoring and multi-host capabilities. Download the script and finish the entire setup with a single command.
📥 Download the Script
Or grab it directly from your terminal:
| |
Overview
NUT (Network UPS Tools) is the industry-standard open-source UPS framework. WalleCube W150 / W180 are fully detected through the generic usbhid-ups driver.
setup-nut.sh automates the following:
- Installs NUT packages (works with
apt/dnf/yum) - Generates every configuration file under
/etc/nut/ - Creates the shutdown-timer event script
- Sets the correct file ownership and runtime directories
- Enables and starts the systemd services
- Verifies the UPS connection automatically
Supported Systems
- Debian / Ubuntu / Armbian
- RHEL / CentOS / Rocky / AlmaLinux / Fedora
- FnOS and other derivatives based on the above distributions
Requires one of
apt-get,dnforyum, and access to the distribution’s package repository.
Installation Steps
1. Connect the Hardware
Plug one end of the UPS USB signal cable into the UPS and the other end into the Linux host.
2. SSH In and Switch to root
| |
3. Download the Script
Pull the latest version directly from the WalleCube site:
| |
Or click the Download setup-nut.sh button at the top of this page and
scpit to the host.
4. Run the Script
| |
The script then asks 4 questions. Press Enter to accept the defaults:
| Parameter | Default | Description |
|---|---|---|
| UPS Name | ups | Identifier used by NUT, e.g. upsc ups@localhost |
| UPS Description | W150 | Human-readable model; change to your actual model (W150 / W180) |
| Monitor Password | mypassword | Password used by upsmon to log into upsd. Change this in production. |
| Shutdown Delay (sec) | 30 | How long on battery before the system shuts down if power isn’t restored |
Confirm with Y to proceed.
What the Script Does
The script runs through 6 stages; any failure aborts the run.
① Install NUT
Detects the package manager and installs nut nut-client nut-server.
② Generate Configuration Files
All files live under /etc/nut/:
nut.conf—MODE=standalone(single-host mode)ups.conf— declares the UPS, driverusbhid-ups, portautoupsd.conf—LISTEN 127.0.0.1 3493(loopback only)upsd.users— defines theupsmonmaster accountupsmon.conf— event notifications and fallback shutdown commandupssched.conf— shutdown countdown and cancellation rules
③ Create /bin/upssched-cmd
Logs the event and runs /sbin/shutdown -h now when the timer expires.
④ Set Permissions
- Auto-detects the
nut/ups/rootuser and group - Config files become
root:<nut-group>with mode640(password protected) - Ensures
/var/run/nutexists with correct ownership
⑤ Enable and Start Services
Tolerates different systemd unit naming across distributions:
| Role | Preferred Unit | Fallback Units |
|---|---|---|
| UPS Driver | nut-driver@<UPS_NAME> | nut-driver / nut-driver.target |
| upsd Server | nut-server | upsd |
| upsmon Monitor | nut-monitor | upsmon |
Each is enabled via systemctl enable --now.
⑥ Verify Connection
The script runs:
| |
If device.type appears in the output, the UPS is connected and key fields (status, load, charge, voltage) are printed.
Status Check
Anytime later, check live status with:
| |
Typical output (excerpt):
| |
Useful Commands
| |
How It Works
| |
Troubleshooting
upsc returns Driver not connected
- Check the USB cable; verify with
lsusbthat the UPS is enumerated. - Inspect the driver:
systemctl status nut-driver@ups.
Access denied or wrong password
- Make sure the password in
/etc/nut/upsmon.confmatches/etc/nut/upsd.users. - When editing either file by hand, update both.
Shutdown does not trigger on power loss
- Look for
upssched-cmdentries in syslog. - Confirm
/bin/upssched-cmdexists and is executable. - Verify
/var/run/nutis owned correctly so the pipe/lock can be created.
Monitoring other hosts remotely
- Add
LISTEN <internal-IP> 3493to/etc/nut/upsd.conf. - Add a
slaveuser in/etc/nut/upsd.users. - On the remote host, configure
upsmon.confwith theslaverole pointing at this server’s IP. - Restart
nut-server.
Re-apply different parameters
Just run the script again — it overwrites the config and restarts the services:
| |
Uninstall
To fully remove the NUT configuration:
| |
Configuration Reference
| File | Purpose | Key Fields |
|---|---|---|
/etc/nut/nut.conf | Run mode | MODE=standalone |
/etc/nut/ups.conf | UPS hardware | driver / port / desc |
/etc/nut/upsd.conf | Server listen | LISTEN |
/etc/nut/upsd.users | Monitor accounts | password / upsmon master |
/etc/nut/upsmon.conf | Client policy | MONITOR / NOTIFYCMD / SHUTDOWNCMD |
/etc/nut/upssched.conf | Event scheduling | AT ONBATT / AT ONLINE |
/bin/upssched-cmd | Event handler | shutdown-timer branch |