« Return to Thread: script question

Re: script question

by Mike Grello :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.

On Tuesday 30 June 2009, Dick Gevers wrote:

> I cooked up a simple script which runs only when gkrellm notes that my cpu

> is getting too hot (because of summertime + setiathome is running 24/24).

>

> To make sure the script runs only once at the same time and not twice

> simultaneously I put in an ...if ... <compare the number of scripts

> running> ... then ...

>

> Now when the script runs (once only) and I issue separately the command:

>

> ps aux |grep <scriptname> |grep -v grep |wc -l

>

> this returns: 1

>

> But when I run the script (with 'bash -x') that contains the same line "ps

> aux.....wc -l" it always returns '2'.

>

> I don't understand why. The number of processes running that include the

> <scriptname> is always one in above example, so why does it return '2' if

> the command is run inside the script and '1' when running separately?

>

> Thanks to anyone who can explain.

>

> Cheers,

> =Dick Gevers=

run it without the wc and see what you get.

--

Our lives begin to end the day we become silent about the things that matter.

-Martin Luther King-

 « Return to Thread: script question