Update install-pingfinder.sh
This commit is contained in:
parent
758558a753
commit
0417c5cb01
1 changed files with 9 additions and 29 deletions
|
|
@ -1,36 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! [ $(id -u) = 0 ]; then
|
||||||
|
echo "Run this as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
read -p "Enter your pingfinder UUID: " pingfinder_uuid
|
read -p "Enter your pingfinder UUID: " pingfinder_uuid
|
||||||
|
|
||||||
cat <<EOF > /etc/systemd/system/pingfinder.service
|
sed 's/pingfinder_uuid/$pingfinder_uuid/d' etc/systemd/system/pingfinder.timer > /etc/systemd/system/pingfinder.timer
|
||||||
[Unit]
|
cp etc/systemd/system/pingfinder.timer /etc/systemd/system/pingfinder.timer
|
||||||
Description=Pingfinder
|
cp usr/local/bin/pingfinder.sh /usr/local/bin/pingfinder.sh
|
||||||
|
chmod +x /usr/local/bin/pingfinder.sh
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
|
|
||||||
Environment=WARNLOCK=$CACHE_DIRECTORY/warn.lock
|
|
||||||
Environment=LOCKFILE=$CACHE_DIRECTORY/exec.lock
|
|
||||||
Environment=UUID=$pingfinder_uuid
|
|
||||||
ExecStart=/usr/local/bin/pingfinder.sh
|
|
||||||
|
|
||||||
DynamicUser=yes
|
|
||||||
CacheDirectory=pingfinder
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF > /etc/systemd/system/pingfinder.timer
|
|
||||||
[Unit]
|
|
||||||
Description=Pingfind periodically
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=1m
|
|
||||||
OnUnitActiveSec=1m
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
curl -JLo /usr/local/bin/pingfinder.sh https://git.m724.eu/Minecon724/dn42-configs/raw/branch/master/usr/local/bin/pingfinder.sh
|
|
||||||
|
|
||||||
systemctl enable pingfinder.timer
|
systemctl enable pingfinder.timer
|
||||||
Loading…
Add table
Add a link
Reference in a new issue