Re: need help on shell programming

2009-03-08 Thread Tzafrir Cohen
On Sun, Mar 08, 2009 at 08:50:25PM +0100, Michael Wagner wrote: > -+ > #! /bin/bash | > | > if [ $(pgrep -x script.sh) ]; then

Re: need help on shell programming

2009-03-08 Thread Michael Pobega
On Sun, Mar 08, 2009 at 08:50:25PM +0100, Michael Wagner wrote: > * Michael Pobega 08.03.2009 > > > #! /bin/sh > > > > if [ $(ps aux | grep script.sh | grep -v grep) ]; then > > > > Hello Michael, > > what about "pgrep"? > > -+ > #! /bin/

Re: need help on shell programming

2009-03-08 Thread Michael Wagner
* Michael Pobega 08.03.2009 > #! /bin/sh > > if [ $(ps aux | grep script.sh | grep -v grep) ]; then > Hello Michael, what about "pgrep"? -+ #! /bin/bash |

Re: need help on shell programming

2009-03-07 Thread Michael Pobega
On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: > I want a script. > The script run a command, wait one minute, > then run the command again, wait one minute again > ... again and again ... > > Thanks! > Just to bring this back up, you can use a mix of shell programming and Cronjobs.

Re: need help on shell programming

2009-03-03 Thread Joe McDonagh
Why is it not the 'best' idea? Infinite loops can be used to your advantage. It's already been remarked that cron will not work because it is fixed-frequency. That means OP will have to start maintaining state via files to avoid race conditions. An infinite while;do;done construct can be inter

Re: need help on shell programming

2009-03-03 Thread Raphael Faria
i dont think that script with an eternal loop is the best ideia. If u want keep this script running for a long time ( even when ur user is loged out, u will need a screen desatached [ screen ^a ^d]). My advice will be that u make this script and set a rule at ur crontab for every min: #crontab

Re: need help on shell programming

2009-02-28 Thread Tzafrir Cohen
On Sun, Mar 01, 2009 at 01:32:32AM -0430, Olaf Reitmaier Veracierta wrote: > Sorry mismatch "then" with "do"... > > while [ 1 -eq 1 ]; do Useless use of test. Use 'true' or ':' instead. You can save a few cycles (mostly of parsing, I guess :-) [1] > >sleep 60 > done [1] http://xkcd.com/

Re: need help on shell programming

2009-02-28 Thread Olaf Reitmaier Veracierta
Sorry mismatch "then" with "do"... while [ 1 -eq 1 ]; do sleep 60 done Boyd Stephen Smith Jr. wrote: On Thursday 26 February 2009 18:35:01 Mike Castle wrote: On Thu, Feb 26, 2009 at 4:29 PM, Michael Pobega wrote: On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: I want a scr

Re: need help on shell programming

2009-02-28 Thread Olaf Reitmaier Veracierta
while [ 1 -eq 1 ]; then sleep 60 done Boyd Stephen Smith Jr. wrote: On Thursday 26 February 2009 18:35:01 Mike Castle wrote: On Thu, Feb 26, 2009 at 4:29 PM, Michael Pobega wrote: On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: I want a script. The script run a command, wai

Re: need help on shell programming

2009-02-27 Thread Boyd Stephen Smith Jr.
On Thursday 26 February 2009 18:35:01 Mike Castle wrote: > On Thu, Feb 26, 2009 at 4:29 PM, Michael Pobega wrote: > > On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: > >> I want a script. > >> The script run a command, wait one minute, > >> then run the command again, wait one minute ag

Re: need help on shell programming

2009-02-26 Thread Alex Samad
On Thu, Feb 26, 2009 at 11:01:37PM +0100, Sjors Gielen wrote: > Kumar Appaiah schreef: >> On Thu, Feb 26, 2009 at 3:54 PM, Long Wind wrote: >>> I want a script. >>> The script run a command, wait one minute, >>> then run the command again, wait one minute again >>> ... again and again ... >> >> wh

Re: need help on shell programming

2009-02-26 Thread Mike Castle
On Thu, Feb 26, 2009 at 4:29 PM, Michael Pobega wrote: > On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: >> I want a script. >> The script run a command, wait one minute, >> then run the command again, wait one minute again >> ... again and again ... >> >> Thanks! >> >> > > Sounds like

Re: need help on shell programming

2009-02-26 Thread Michael Pobega
On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: > I want a script. > The script run a command, wait one minute, > then run the command again, wait one minute again > ... again and again ... > > Thanks! > > Sounds like a job for Cron! -- http://pobega.wordpress.com

Re: need help on shell programming

2009-02-26 Thread Kumar Appaiah
On Thu, Feb 26, 2009 at 4:01 PM, Tzafrir Cohen wrote: >>  while [[ 1 < 2 ]]; do echo Hello; sleep 60;done > > Not only bashism, but also not as readable. > >> >> Replace "echo Hello" with your command. > > > #!/bin/sh > while true > do >  your command >  sleep 60 > done Thanks for the improved one

Re: need help on shell programming

2009-02-26 Thread Sjors Gielen
Kumar Appaiah schreef: On Thu, Feb 26, 2009 at 3:54 PM, Long Wind wrote: I want a script. The script run a command, wait one minute, then run the command again, wait one minute again ... again and again ... while [[ 1 < 2 ]]; do echo Hello; sleep 60;done [[ 1 < 2 ]] ? My suggestion: while

Re: need help on shell programming

2009-02-26 Thread Tzafrir Cohen
On Thu, Feb 26, 2009 at 03:56:54PM -0600, Kumar Appaiah wrote: > On Thu, Feb 26, 2009 at 3:54 PM, Long Wind wrote: > > I want a script. > > The script run a command, wait one minute, > > then run the command again, wait one minute again > > ... again and again ... > > while [[ 1 < 2 ]]; do echo H

Re: need help on shell programming

2009-02-26 Thread Gilles Mocellin
On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote: > I want a script. > The script run a command, wait one minute, > then run the command again, wait one minute again > ... again and again ... Look at the "watch" package/program. signature.asc Description: Digital signature

(SOLVED)Re: need help on shell programming

2009-02-26 Thread Long Wind
Thank you very much! On 2/26/09, Kumar Appaiah wrote: > On Thu, Feb 26, 2009 at 3:54 PM, Long Wind wrote: > > I want a script. > > The script run a command, wait one minute, > > then run the command again, wait one minute again > > ... again and again ... > > > while [[ 1 < 2 ]]; do echo Hel

Re: need help on shell programming

2009-02-26 Thread Kumar Appaiah
On Thu, Feb 26, 2009 at 3:54 PM, Long Wind wrote: > I want a script. > The script run a command, wait one minute, > then run the command again, wait one minute again > ... again and again ... while [[ 1 < 2 ]]; do echo Hello; sleep 60;done Replace "echo Hello" with your command. HTH. Kumar --