Browse Source

Rename the script + use systemd timer functionality

master
Fincer 6 years ago
parent
commit
5f3ea7543b
4 changed files with 28 additions and 25 deletions
  1. +0
    -0
      wanchecker.sh
  2. +14
    -0
      wanchecker@.service
  3. +14
    -0
      wanchecker@.timer
  4. +0
    -25
      wanip-checker@.service

wanip-checker.sh → wanchecker.sh View File


+ 14
- 0
wanchecker@.service View File

@ -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

+ 14
- 0
wanchecker@.timer View File

@ -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

+ 0
- 25
wanip-checker@.service View File

@ -1,25 +0,0 @@
# Should be placed to /usr/lib/systemd/user/
####
# Usage
# systemctl --user enable wanip-checker@<username>.service && \
# systemctl --user start wanip-checker@<username>.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

Loading…
Cancel
Save