G
Guest
Guest
I want to write a short command to kill my internet connection at 7am each morning, so that the phone line isn't tied up in the morning if I leave the computer downloading over night...
So far, I have come up with...
ps -C pppd -o "%p" | tail -1 | kill -HUP
which doesnt work...
why?
Once I have this command worked out I plan to put it in a Cron file...
The only clue I have so far is, that the input for kill is the pid of pppd, but with one space before it. I dont know how to get rid of this. Also, I dont know if kill can take a pid input through a pipe in this manner.
Please, someone help me... I wont be offended if you have a better, more elegant way of going about this -- I started off with ps -e | grep pppd....
I doubt you'd need me to explain what I have so far, but maybe it will save the time of looking through man pages..
ps -C pppd -o "%p" (lista all processes called ppps, showing only thier PID)
tail -1 (takes input from pipe, outputs the last line -- the pid of pppd with a space infront)
kill -HUP (pid) (sends the process the hangup signal, so that it restarts, I dont want to kill pppd becuase I will want to connect again later no doubt ; )
Thanks heaps if you got this far without being thoroughly bored, and thanks even more if you can tell me what I'm doing wrong...
Michael Whiteman
So far, I have come up with...
ps -C pppd -o "%p" | tail -1 | kill -HUP
which doesnt work...
why?
Once I have this command worked out I plan to put it in a Cron file...
The only clue I have so far is, that the input for kill is the pid of pppd, but with one space before it. I dont know how to get rid of this. Also, I dont know if kill can take a pid input through a pipe in this manner.
Please, someone help me... I wont be offended if you have a better, more elegant way of going about this -- I started off with ps -e | grep pppd....
I doubt you'd need me to explain what I have so far, but maybe it will save the time of looking through man pages..
ps -C pppd -o "%p" (lista all processes called ppps, showing only thier PID)
tail -1 (takes input from pipe, outputs the last line -- the pid of pppd with a space infront)
kill -HUP (pid) (sends the process the hangup signal, so that it restarts, I dont want to kill pppd becuase I will want to connect again later no doubt ; )
Thanks heaps if you got this far without being thoroughly bored, and thanks even more if you can tell me what I'm doing wrong...
Michael Whiteman