|
[Sponsors] |
February 11, 2020, 11:37 |
Running Allrun script as a superuser
|
#1 |
Member
Alejandro Valeije
Join Date: Nov 2014
Location: Spain
Posts: 52
Rep Power: 12 |
Hello foamers,
I am currently developing a small GUI with Java to run openFOAM cases with it. This GUI is meant to internally open a new terminal and execute the designated script. The 5 first lines of my script are the following: #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions As you can see, these are the first lines in every Allrun script from every openFoam case. The problem comes when running this script with the GUI. I think that it tries to execute it as a superuser and it tries to execute the following: sudo ./RunCase And the result is: ./RunCase: 5: .: Can't open /bin/tools/RunFunctions So the question is: is there any way of running these type of scripts as a superuser? I don't think I'm able to change the routine that the GUI does when opening a terminal. Thanks in advance |
|
February 11, 2020, 14:04 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
did you source OpenFOAM etc/bashrc somewhere prior to Allrun?
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
February 12, 2020, 05:12 |
|
#3 |
Member
Alejandro Valeije
Join Date: Nov 2014
Location: Spain
Posts: 52
Rep Power: 12 |
In my /home/user/.bashrc the last line is:
source /opt/openfoam6/etc/bashrc Since it seems that executing the script as a suepruser is not reading that line, I have tried to write the same line also in the script, before the RunFunctions line, but then, the error message is that the command source is not found. I have also tried to write sudo source /opt/openfoam6/etc/bashrc alone in a terminal and the error reamins the same: command not found, so I guess the error goes in that direction, but I don't know how to fix it |
|
February 12, 2020, 10:41 |
|
#4 | |
New Member
Join Date: Sep 2019
Posts: 17
Rep Power: 7 |
Quote:
See the information here: https://askubuntu.com/questions/5045...nning-a-script There is something going on with source being a bash command. Try using this as the first line: Code:
#!/bin/bash |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Running OpenFOAM case through shell script (bash) | ilaj | OpenFOAM Programming & Development | 2 | January 28, 2020 14:14 |
Problem running Allrun | ivanfb95 | OpenFOAM | 0 | March 6, 2017 05:36 |
How can i activate the Allrun script? | spk | OpenFOAM | 2 | October 2, 2011 18:28 |
Empty Allrun script | mwild | OpenFOAM Bugs | 4 | August 25, 2009 03:43 |
Kubuntu uses dash breaks All scripts in tutorials | platopus | OpenFOAM Bugs | 8 | April 15, 2008 08:52 |