Sponsored Content
Full Discussion: Loops
Top Forums UNIX for Advanced & Expert Users Loops Post 52978 by mariner on Thursday 1st of July 2004 05:58:07 AM
Old 07-01-2004
Loops

Can anybody help please.

I am trying to right a script which will loop until a certain action has been performed. For example i current have two batch jobs i would like to put into a wait status. Batch Jobs A and B . The script i am trying to get to work is below.

jobs="A B"
COUNT=0

while [ $COUNT -lt 2 ]
do
for batch in $jobs
do
echo "Holding suite" ( I have a line here that kicks off a holding script)
echo "Get status" (I have a line here that gets the status of the batch job)

if [ $status = "Wait" ]
then
COUNT=`expr $COUNT + 1`
fi
done
done

Now this seems to almost work except if one batch job for example B. If that finishes first it will add one start the loop again see that A has not finished go through B again and add another one making the COUNT to equal 2 stopping the loop. I need a loop that will keep looping just A until that has gone to a Wait state and then move onto B.
I know this is slightly confusing but if anyone could help it would be apprectiated as it is annoying me now.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

loops?

hello....very new user to unix...and i have a question..i am not sure if there is such a thing For example...the user is asked if he likes Bananas....if he says yes.... echo You like Bananas $name at the end of the script it echos all that the user has entered so they can read it.... but... (1 Reply)
Discussion started by: jonas27
1 Replies

2. Shell Programming and Scripting

Loops within loops

I am running on HPUX using ksh. I have a script that uses a loop within a loop, for some reason the script seems to hang on a particuliar record. The record is fine and hits the condition in Blue. If I kill the 1st loop process the script continues on with no problem. Begin code> <Some... (8 Replies)
Discussion started by: bthomas
8 Replies

3. UNIX for Dummies Questions & Answers

While Loops

I'm trying to create a loop that will prompt the user for 15 values, not forcing them to enter all 15. If the user enters through one or more of the prompts the null value needs to be converted to 0, otherwise set the parameter = to the value entered: ex. Please enter file no #1: 17920 ... (4 Replies)
Discussion started by: vdc
4 Replies

4. UNIX for Dummies Questions & Answers

two loops

Hi, how can I use "for" to have two loops : this is my script : for i in (A B C) do for j in (a b c) do echo $i$j done done #End I want to print out Aa Ab Ac .... But I have error message : syntax error at line 1 : `(' unexpected Many thanks before. How should I use "for" ?? (2 Replies)
Discussion started by: big123456
2 Replies

5. Shell Programming and Scripting

while loops

Hi I've a file like so: Now, I want to read my file and take ex. the Media ID and the Type for each groups of Media (Media1,Media2,...,Media(n): cat /tmp/file|\ while read FILE do while $(FILE|cut -d: -f1)=Media$i do #here will be some test, ex: #if Media ID < 23 ... (4 Replies)
Discussion started by: nymus7
4 Replies

6. UNIX for Dummies Questions & Answers

Help with While Loops

I am traversing down a list, and I am not quite sure how to tell the loop to break when it's done going through the file. #!/bin/sh while : do read list <&3 echo $list done is the code. The file "list" is simply 5 4 3 2 1 any advice on how to break the loop after the file is... (1 Reply)
Discussion started by: MaestroRage
1 Replies

7. Shell Programming and Scripting

Help with the 2 for loops

#!/bin/bash IFS=$'\n' A= a c b t g j i e d B= t y u i o p counter=0 found="" for i in $(cat $A) do for j in $(cat $B) do if then found="yes" fi done if then (1 Reply)
Discussion started by: vadharah
1 Replies

8. Shell Programming and Scripting

Loops

Hi All, I want to execute a script the number of times a user enters. Please can you advise on hor can I do the same. Many Thanks, Shazin (4 Replies)
Discussion started by: Shazin
4 Replies

9. UNIX for Dummies Questions & Answers

loops with tr

Hello, I'm not sure if this is more appropriate for the 'unix for dummies' or the 'unix for experts' forum because I'm new to this forum and this is the second topic I've discussed, but if you could let me know which one was more appropriate for something like this, please do! So in tr (an... (2 Replies)
Discussion started by: juliette salexa
2 Replies

10. UNIX for Dummies Questions & Answers

Need help with for loops

Why wont my for statements work? Im trying to get this script to swich to a user an if you put in a start/stop/or restart paramater to do just that for each user. I commented out the actual start/stop actions to test it just by using echos and not do anything hasty in the environment but it... (0 Replies)
Discussion started by: LilyClaro
0 Replies
yade-batch(1)						      General Commands Manual						     yade-batch(1)

NAME
yade-batch - batch system for computational platform Yade SYNOPSIS
yade-batch [options] [ TABLE [SIMULATION.py] | SIMULATION.py[/nCores] [...] ] DESCRIPTION
yade-batch Manage batches of computation jobs for the Yade platform; batches are described using text-file tables with parameters which are passed to individual runs of yade. Jobs are being run with pre-defined number of computational cores as soon as the required number of cores is available. Logs of all computations are stored in files and the batch progress can be watched online at (usually) http://local- host:9080. Unless overridden, the executable yade is used to run jobs. OPTIONS
--help, -h show this help message and exit --jobs=NUM, -j NUM Maximum number of simultaneous threads to run (default: number of cores, further limited by OMP_NUM_THREADS if set by the environ- ment: 4) --job-threads=NUM Default number of threads for one job; can be overridden by per-job with !THREADS (or !OMP_NUM_THREADS) column. Defaults to 1. --force-threads Force jobs to not use more cores than the maximum (see -j), even if !THREADS colums specifies more. --log=FORMAT Format of job log files: must contain a $, % or @, which will be replaced by script name, line number or by description column respectively (default: $.@.log) --global-log=FILE Filename where to redirect output of yade-batch itself (as opposed to --log); if not specified (default), stdout/stderr are used --lines=LIST, -l LIST Lines of TABLE to use, in the format 2,3-5,8,11-13 (default: all available lines in TABLE) --nice=NICE Nice value of spawned jobs (default: 10) --cpu-affinity Bind each job to specific CPU cores; cores are assigned in a quasi-random order, depending on availability at the moment the jobs is started. Each job can override this setting by setting AFFINE column. --executable=FILE Name of the program to run (default: /tmp/buildd/yade-0.80.1/debian/inst/bin/yade). Jobs can override with !EXEC column. --rebuild Run executable(s) with --rebuild prior to running any jobs. --debug Run the executable with --debug. Can be overriddenn per-job with !DEBUG column. --gnuplot=FILE Gnuplot file where gnuplot from all jobs should be put together --dry-run Do not actually run (useful for getting gnuplot only, for instance) --http-wait Do not quit if still serving overview over http repeatedly --generate-manpage=FILE Generate man page documenting this program and exit --plot-update=TIME Interval (in seconds) at which job plots will be updated even if not requested via HTTP. Non-positive values will make the plots not being updated and saved unless requested via HTTP (see --plot-timeout for controlling maximum age of those). Plots are saved at exit under the same name as the log file, with the .log extension removed. (default: 120 seconds) --plot-timeout=TIME Maximum age (in seconds) of plots served over HTTP; they will be updated if they are older. (default: 30 seconds) --refresh=TIME Refresh rate of automatically reloaded web pages (summary, logs, ...). --timing=COUNT Repeat each job COUNT times, and output a simple table with average/variance/minimum/maximum job duration; used for measuring how various parameters affect execution time. Jobs can override the global value with the !COUNT column. --timing-output=FILE With --timing, save measured durations to FILE, instead of writing to standard output. --randomize Randomize job order (within constraints given by assigned cores). SEE ALSO
yade (1) https://yade-dem.org/sphinx/user.html#batch-queuing-and-execution-yade-batch COPYRIGHT
(C) 2003--2012 Yade Developers Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. BUGS
Please report bugs to the project's bug tracker at http://bugs.launchpad.net/yade AUTHOR
Yade Developers Team (http://www.launchpad.net/~yade-dev) yade-batch 2012-7-4 yade-batch(1)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy