Re: variables in the run script

From: Jameson Graef Rollins <jrollins_at_finestructure.net>
Date: Tue, 08 Oct 2013 23:07:58 -0700

On Tue, Oct 08 2013, Subba Rao <umroute_at_tanucoo.com> wrote:
> On 10/8/13 8:38 PM, Jameson Graef Rollins wrote:
>> On Tue, Oct 08 2013, Subba Rao <umroute_at_tanucoo.com> wrote:
>>> I have a run script that has an infinite loop performing some cleanup
>>> functions, system monitoring functions etc. Once the tasks in one loop
>>> cycle are completed, I want the loop in "run" script to sleep for some
>>> random #hours before starting a new loop cycle. I have been trying to
>>> use the $RANDOM in bash for the sleep time.
>>>
>>> while :
>>> do
>>> Function1
>>> Function2
>>> slp=$(( $RANDOM % 14 + 22)) /* Any number from 22 to 36 */
>>> zzz="${slp}h" /* Append "h" for hours */
>>> echo $zzz >> ./log.txt /* echo $zzz to log file */
>>> sleep $zzz /* sleep for $slp hours */
>>> done
>> Hi, Subbarao. I'm not sure if this is just a red herring, but the
>> syntax you've written here is confusing. "/*" is not a valid comment
>> character string in shell, so if this represents the actual content of
>> the script it should definitely not work. The comment character for
>> shell character "#".
>>
>> jamie.
> When I posted this, I was thinking of C programming syntax. I have not
> documented by original script yet. I added the C syntax only to show
> the logic.

Providing the actual script might help people help you. It's hard to
know which of the code you've provided is problematic if it's not
already in an appropriate syntax.

jamie.



Received on Wed Oct 09 2013 - 06:07:58 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC