24 lines
785 B
Bash
24 lines
785 B
Bash
#!/bin/sh
|
|||
|
|
set -eu
|
||
|
|
|
||
|
|
if [ "$(id -u)" -ne 0 ]; then
|
||
|
|
echo "Run this installer as root (sudo ./install.sh)" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
command -v rrdtool >/dev/null 2>&1 || {
|
||
|
|
echo "rrdtool is required: apt install rrdtool" >&2
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|
||
|
|
install -d /usr/local/lib/cheap-system-monitor /var/lib/cheap-system-monitor
|
||
|
|
install -m 0755 system_monitor.py generate_graphs.py /usr/local/lib/cheap-system-monitor/
|
||
|
|
install -m 0644 systemd/*.service systemd/*.timer /etc/systemd/system/
|
||
|
|
if [ ! -e /etc/cheap-system-monitor.conf ]; then
|
||
|
|
install -m 0644 cheap-system-monitor.conf.example /etc/cheap-system-monitor.conf
|
||
|
|
fi
|
||
|
|
|
||
|
|
systemctl daemon-reload
|
||
|
|
systemctl enable --now cheap-system-monitor.timer cheap-system-monitor-graphs.timer
|
||
|
|
echo "Installed. Edit /etc/cheap-system-monitor.conf if needed."
|