In one of my OS X scripts, I used the following to check the running process.
ps -aux | grep '/etc/bkupexec/agent.be'
However, it doesn’t always work. I didn’t know exactly why. On one occasion, I found that if I run the script in a wide window and it works every time. I knew that it’s related to the window size then. How do I set it so that the script runs regardless the window size. The answer is right in the manual page.
-w Use 132 columns to display information, instead of the default which is your window size. If the -w option is specified more than once, ps will use as many columns as necessary without regard for your window size.
After I changed the script to
ps -auxww | grep '/etc/bkupexec/agent.be'
, it runs flawlessly every time.
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.
Unbelievable!
I’ve had this exact same issue pop up, most recently this week, when I was out of town and remotely connected to my Mac to see if I left Mail running. According to the output of ps -aux, I wasn’t. When I got home, and widened the window, sure enough, it was running!
Amazing timing of your note. Thanks!
John
Er… has Mac gone solaris or something? I can’t use ps -auxw on Leopard, I get “no user xw”.
Leopard is now Unix certified. If you use
ps -few
it produces similar results.