dn42-configs/install-pingfinder.sh

22 lines
No EOL
588 B
Bash

#!/bin/sh
set -euo pipefail
if ! systemd-notify --booted; then
echo "Systemd is required"
exit 1
fi
if ! [ $(id -u) = 0 ]; then
echo "Must be run as root"
exit 1
fi
read -p "Enter your pingfinder UUID: " pingfinder_uuid
sed "s/pingfinder_uuid/$pingfinder_uuid/g" etc/systemd/system/pingfinder.service > /etc/systemd/system/pingfinder.service
cp etc/systemd/system/pingfinder.timer /etc/systemd/system/pingfinder.timer
cp usr/local/bin/pingfinder.sh /usr/local/bin/pingfinder.sh
chmod +x /usr/local/bin/pingfinder.sh
systemctl daemon-reload
systemctl enable pingfinder.timer