Automate execution of command line
Hi,
I would like to automate execution of command line with a script (On Ubuntu). Moreover, I want that the second line begin when the first line is finished. For exemple : * cd User/Cas1 * blockMesh * snappyHexMesh * sudo cp Cas1/0 Cas1/3 // copy of the boundary conditions * decomposePar * foamJob -parallel -screen simpleFoam * reconstructPar * cd User/Cas2 * blockMesh * snappyHexMesh * sudo cp Cas1/0 Cas1/3 // copy of the boundary conditions * decomposePar * foamJob -parallel -screen simpleFoam * reconstructPar * cd User/Cas2 * etc ... Thanks all for your help |
Quote:
|
Ok.
The file is a text file (.txt) ? |
The file is plain text, but the extension is not important. I usually end them in .sh, but if you prefer you can use .txt, or no extension at all.
|
Ok, thanks.
Edit : It works :) |
Is it possible to use the script to modify the parameters of velocity inlet in the text file ?
|
|
Quote:
But of course sed has the advantage to be installed everywhere |
What did you think about gnu m4 ? (
http://www.somogyibence.hu/documents...ckMesh_m4.html) |
Quote:
Seriously: I think the main purpose of M4 is generating text files, not analyzing them. So it might be just the opposite of what you're looking for |
Ok, thanks for your response.
|
Have you an example of BlockMesh script ? (Example of your script wrote with PyFoam)
|
Quote:
I'm planing to add a more sophisticated templating-mechanism to later versions of PyFoam |
Dear All,
pardon the question, but I think that this does not work. In fact I have my launch.sh file which is the following: Code:
'#!/bin/bash' Any idea about that? Thanks a lot, Samuele |
Hi
foamJob sends the solving process to the background and redirects its output to a log file, hence your following commands get to start as soon as the case starts. |
Dear Pablo,
thanks for answering. I know that it is as you say, i.e. that foamJob solves in BG.. What I would like to know is if it is possible to launch all the commands that I give in BG on a server, executing them one after the other. Thanks a lot, Samuele |
Hi
it is very easy: Code:
mpirun -np 8 buoyantPimpleFoam -parallel > log Regards |
If I give the command you suggested (i.e. mpirun -np 8 buoyantPimpleFoam -parallel > log), I'll launch the program in foreground and when I close the terminal where I am running it, the execution stops.
Let me try to explain what I wanna do: maybe you can help me. I am performing some simulations on a server. I connect via ssh, from my laptop. The point is that if I am working in serial, I can give Code:
buoyantPimpleFoam > log Code:
ctrl z + bg Code:
disown With mpirun, this syntax doesn't work, hence I user foamJob. What should I do, to you? Thanks a lot, Samuele |
Quote:
|
If I understood well, I can write a launch.sh file like this:
Code:
'#!/bin/bash' Thanks a lot, Samuele |
Greetings to all!
@samiam1000: The first line shouldn't have quotes: Code:
#!/bin/bash By what I can understand, it's not foamJob that needs nohup, it's the call to this script that needs this! For example, if you call this script "runcase.sh", you'll need to:
Best regards, Bruno |
Quote:
|
All times are GMT -4. The time now is 04:48. |