I have a script to back up my online email, which I now run with a crontab. But I would like to run the backup script only when I am attached to a particular network. Is that possible without writing an intermediate script run by crontab that checks my IP and then conditionally runs the backup script? That is, is there a utility in Debian that simplifies this scenario?
Helmut Grohne
[ Editor ]
Maybe you can hook into the networking scripts? You can place shell scripts in /etc/network/ip-up.d. They are executed whenever you ifup any network interface (it is stored in the IFACE environment variable). You can even configure this hook script via /etc/network/interfaces. If you write a line “foo bar” below an interface definition, there is an environment variable IF_FOO=bar.