Sometimes you want to execute a particular command, but only when you're at home. Examples would be running fetchmail (or fetchnews) through cron, but you don't want this to run when you're in the train, connected to the Internet through GPRS...
My idea here would be to create a script (say "athome.sh") which returns 0 if you're at home, and 1 otherwise. The key of the script is that the MAC address of your (default) gateway is unique.
1 2 3 4 5 6 7 8 9 10 11
With this script, you can then run
athome.sh && fetchmail. If you
athome.sh will return 1 and the fetchmail command will
never be executed. When you are, the command returns 0 and fetchmail is