cyberpower-exporter/install.sh

30 lines
618 B
Bash
Raw Normal View History

2024-07-22 13:44:29 -04:00
#!/bin/bash
if [ "$UID" != "0" ]; then
echo "Please run as root"
exit 1
fi
# Install UPS driver
if [ -z "$(which pwrstat)" ]; then
echo "Installing Power Panel..."
dpkg -i powerpanel.deb
fi
# Setup exporter
echo "Installing Exporter..."
2024-07-22 13:51:59 -04:00
cp ups-exporter.js /usr/local/bin/ups-exporter.js
chmod +x /usr/local/bin/ups-exporter.js
2024-07-22 13:44:29 -04:00
# Setup service
echo "Stting Up Service..."
2024-07-22 13:51:59 -04:00
cp ups-exporter.service /etc/systemd/system/ups-exporter.service
chmod +x /etc/systemd/system/ups-exporter.service
systemctl enable ups-exporter
systemctl restart ups-exporter
2024-07-22 13:44:29 -04:00
echo "Done!"
sleep 1
echo ""
2024-07-22 13:51:59 -04:00
journalctl -u ups-exporter -n 1