Hi all, I have a script I use to backup my computer using restic to a backup rest server on my home network. I can set up a timer to do this Daily, however I don’t want it trying to backup automatically if I’m not on my home network. Any suggestions on what I can put in a systemd-timer to check which network I am on before triggering the backup?
Not clear what you mean…
Do you mean it should start backup only if you are logged in to your home machine?
If so, the systemd service can call any script in
ExecStart= line, and the script can see who is logged in with commands like
w, and proceed accordingly.
Or did you mean something else?
Not really I mean it should only trigger if I’m on my home network and not traveling. Basically I don’t want to trigger a backup over wifi if I’m in a hotel or at my Mom’s
Have the timer calls a script which checks your IP address. If it matches, do the backup, if not do nothing.
Thanks that’s what I was thinking but was wondering if there was something more systems. That said a script is probably the Simplist approach
what I ended up doing was writing a short scrip that checked the output of iwgetid and if the SSID matches I run my backup. if not it does nothing. Then just added a systemd service and timer. works great!