more useful options | |
PerlMonks |
IPC: trouble killing off processby skillet-thief (Friar) |
on Aug 13, 2004 at 15:52 UTC ( [id://382731]=perlquestion: print w/replies, xml ) | Need Help?? |
skillet-thief has asked for the wisdom of the Perl Monks concerning the following question: Hello Monks! I never thought I would need to bother with IPC, but I guess one should never say things like that. Here is my current problem: after moving to a place with no possibility of a DSL connection, I am trying to make the most of my dialup connection by having my Linux box connect automatically every night, get my mail with fetchmail and use either wget or LWP to download the sites that I read everyday. The whole thing will be run as a cron job. I am using wvdial to run my dialup. I need some kind of forking mechanism so that I can connect through wvdial with one process, and do my online stuff with the other, then kill wvdial when I'm done. wvdial waits for a control-c (SIGINT, as far as I know) to exit. The simplest solution would have been to use sytem("wvdial &"). If I do this, however, I don't have a pid to kill when I'm done, at least not with a perl ipc solution. (I know that I could use ps to get wvdial's pid...)
My attempts with fork and open haven't been much more fruitful, but for different reasons. With fork, when I kill the child process, wvdial survives for some reason. And with is the pid of the fork, and not that of wvdial itself. So, once again, killing of the fork process isn't enough. Here is my best try so far, using fork:
Thanks in advance for any and all wisdom! s-t
Back to
Seekers of Perl Wisdom
|
|