|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
script questionI 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= |
|
|
Re: script questionOn 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- |
|
|
Re: script questionOn Tue, 30 Jun 2009 17:58:25 -0400, Mike Grello wrote about Re: [Expert]
script question: >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. I still see only one instance of the script running....!? |
|
|
Re: script questionOn Tuesday 30 June 2009, Dick Gevers wrote: > On Tue, 30 Jun 2009 17:58:25 -0400, Mike Grello wrote about Re: [Expert] > > script question: > >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. > > I still see only one instance of the script running....!? The script is only being run once; more than likely the -x breaks up the piped command for better reporting and so it shows up twice in the search. -- The assertion that "all men are created equal" was of no practical use in effecting our separation from Great Britain and it was placed in the Declaration not for that, but for future use. -- Abraham Lincoln |
|
|
Re: script questionOn Tue, 30 Jun 2009 18:25:42 -0400, Mike Grello wrote about Re: [Expert]
script question: >> I still see only one instance of the script running....!? >The script is only being run once; more than likely the -x breaks up the >piped command for better reporting and so it shows up twice in the search. Yes, that could be it. Hard to tell for sure. Thanks anyway. Cheers, =Dick Gevers= |
| Free embeddable forum powered by Nabble | Forum Help |