Run a script when PPP is started or stopped

Nov 25, '01 02:59:33AM

Contributed by: Anonymous

I recently discovered that if you have a script located at /etc/ppp/ip-up then it will get called every time a PPP connection is started. Similarly, if you have a script at /etc/ppp/ip-down then it will get called every time the connection goes down. It is important that the execute bit is set on the script, and you proabably have to be root to create and save the file. Here's how to set the execute bits on the two scripts:

chmod a+x ip-up
chmod a+x ip-down
I use it to start and stop fetchmail (pop-smtp mailing software). But by using 'open', you could probably do anything. A word of caution: It may be running stuff as root so a sudo username whatevercommands might be useful.

[Editor's note: I don't have a PPP connection, so I can't test this...]

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20011125025933762