I am on Oracle Linux I have a shell script which does the following:
# Some things are happening here Gnome-Terminal - Title = 'my application' -x / path / my_application -param val #some more stuff Now, it is possible that the script has several times Will be executed. However, I just want to start the my_application if it is already running, I found the following code: ps cax | Grep my_application & gt; / Dev / null if [$? -E 0 0]; Then "My app is already running." Other GNOME-Terminal - Title = 'My application' -x / path / my_application -param val fi This works fine. Here's a problem I have a second shell script, it runs my_application , but with different parameters. It is possible that both the scripts should be executed simultaneously. If this happens, then there should be two examples of running my_application , because they have different parameters, I thought that giving a different title to each GNOME-terminal, then verify that the title As well as a GNOME-terminal already exists before launching my_application . He said, I am going to go completely wrong on this, so any suggestions are welcome.
In summary, I have two scripts that both start the same application, but with different criteria. Both scripts can be executed simultaneously and many times if a given script has started the application, then after re-implementing the script, the application should not resume (assuming that the application still going on). However, starting a application with a script should not prevent other scripts from starting the same application.
script 1:
CMD = "gnome-terminal - title = 'My application' -x / path / my_application- the ultimate val "flock-n / var / lock / mylock1 $ CMD || Echo "My app is already running." script 2:
CMD = "genome-terminal - title = 'my app' -x / path / my_application -param val" flock - N / Var / lock / mylock2 $ CMD || Echo "My app is already running."
No comments:
Post a Comment