[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Waiting for scripts in /etc/ppp/ip-up.d



Background:
I have my PPP connection to my ISP set up, pretty much out of the box.
In /etc/ppp/ip-up.d, I have some scripts, one to send queued mail, one
to get a newsfeed via slrnpull. I will probably add extra scripts later
(mirror my homepages, download new packages, cache web pages,
whatever...)

My ISP also sends my Email via SMTP while I'm online. I can tell when
it's finished by fingering the post machine, and checking if it has any
messages left for me.

What I'd like to do is to write a script which starts the PPP
connection, then waits for all the ip-up.d scripts to run, and for my
mail to finish arriving, and then drops the connection with poff
(actually, I'd like it to ask me whether it was OK to go offline, and
allow me to override, but that's not too hard).

So, my question - can I do this? My guess is that I somehow need to loop
checking on the status of the various processes (probably by parsing ps
aux output) until everything has completed. But that may be messy, and
it almost certainly needs significant admin when I add new ip-up
scripts. I thought about using pstree or something, to look for children
of the pon script - does that work?

Any pointers?

Thanks,
Paul Moore.

PS Is it possible for a script to tell if it's running under X? Ideally,
I'd like to query the user via a dialog box if in X, but use a normal
stdin read otherwise...


Reply to: