diff --git a/wanip-checker.sh b/wanchecker.sh similarity index 100% rename from wanip-checker.sh rename to wanchecker.sh diff --git a/wanchecker@.service b/wanchecker@.service new file mode 100644 index 0000000..399aee7 --- /dev/null +++ b/wanchecker@.service @@ -0,0 +1,14 @@ +# Should be placed to /usr/lib/systemd/user/ + +[Unit] +Description=WAN IPv4 checker & email sender for dynamic IPv4 server environments +After=network-online.target + +[Service] +ExecStart=/usr/bin/bash /home/%i/wanchecker.sh + +# Emailing fails if this is enabled +#NoNewPrivileges=true + +[Install] +WantedBy=default.target diff --git a/wanchecker@.timer b/wanchecker@.timer new file mode 100644 index 0000000..587f929 --- /dev/null +++ b/wanchecker@.timer @@ -0,0 +1,14 @@ +# Should be placed to /usr/lib/systemd/user/ + +# https://wiki.archlinux.org/index.php/Systemd/Timers + +[Unit] +Description=Run WAN IP checker in fixed intervals and on boot + +[Timer] +OnBootSec=2min +OnUnitActiveSec=20min +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/wanip-checker@.service b/wanip-checker@.service deleted file mode 100644 index be69f32..0000000 --- a/wanip-checker@.service +++ /dev/null @@ -1,25 +0,0 @@ -# Should be placed to /usr/lib/systemd/user/ - -#### -# Usage - -# systemctl --user enable wanip-checker@.service && \ -# systemctl --user start wanip-checker@.service && \ -# systemctl --user daemon-reload - -[Unit] -Description=WAN IPv4 checker & email sender for dynamic IPv4 server environments -After=network-online.target - -[Service] -ExecStart=/usr/bin/bash /home/%i/wanip-checker.sh - -# Restart (check) every 20 minutes (1200 seconds) -RestartSec=1200 -Restart=always - -# Emailing fails if this is enabled -#NoNewPrivileges=true - -[Install] -WantedBy=default.target