Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Norrow down that 'PS' output by piping it to 'GREP'' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: Cerberus on Jun 01, '02 09:59:53PM

You can modify your 'ps ax' command to 'ps ax | grep pppd' and you will ONLY see 2 lines, the ACTUAL pppd deamon and the command you just typed in, like this:

3049 ?? Ss 0:06.75 pppd
4308 std S+ 0:00.03 grep pppd

This will save you having to scroll backwards to find pppd in that output and then just follow the rest of the tip.



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: FlyBoy on Jun 01, '02 10:36:05PM

Or you could do the following and eliminate the grep process in the ps list:

ps ax | grep -v grep | grep pppd



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: FlyBoy on Jun 01, '02 10:49:18PM

Here's an even better way to do it in one step:

kill -HUP `ps ax | grep -v grep | grep pppd | awk '{print $1}' `

This finds the process number for the pppd process and passes it to the kill command.



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: ret on Jun 03, '02 02:36:54AM
grep pipe to grep? That's a cardinal sin! :-)

Do this:
ps ax | grep p[p]pd | ...

Using the regexp in there means the grep process won't match itself in the process listing.

cheers
RET

PS: How bad will the backslashitis be on this reply?

[ Reply to This | # ]
Script Menu Item
Authored by: Anonymous on Jun 02, '02 01:07:29AM
Create an AppleScript with the following and place it in your Script Menu Items folder. No need to open the terminal with this... Not sure you need the admin pass to kill pppd but put it in just in case (No dial-up access to test with). If not just remove with administrator privileges.

on run
do shell script "kill -HUP `ps ax | grep -v grep | grep pppd | awk '{print $1}' `" with administrator privileges
end run

[ Reply to This | # ]
Script Menu Item
Authored by: stetner on Jun 02, '02 02:14:20AM

How about:

sudo kill -HUP `cat /var/run/ppp0.pid`



[ Reply to This | # ]