Hi guys,
I need to control that the same app can't run in two servers at the same times.
This app is stored in directory, which it's share between these two servers.
If one instances is running in one of the servers and someone from the other server execute the same script (star) from the other server, everythind going down and someone will kill me.
Please anyone tell/guide me .
I understand the app is run from a script, both residing on a shared directory accessible by both servers. Have you considered creating a "lock" file in your start script, and not run the app when that file exists? On exiting, the lock file is removed, giving way for the second server to execute the app.
i think the same as rudic said.
may be way of doing is different
use one file to maintain the status of a script.
and at the start of the file check the status and accordingly run the script. 
The principal idea it's run just ONE app, never two instances, Just ONE app between the 2 servers
---------- Post updated at 02:22 PM ---------- Previous update was at 02:18 PM ----------
Look guys i have the pseudo code in my head, but i don't know how write what you said.
Sth. like
[ -f /shared/directory/lockfile ] && { echo "Application running on other server"; exit 1; }
touch /shared/directory/lockfile
... body of script ...
rm /shared/directory/lockfile
Needs mayhap a little polishing...
ok.
one quick one.
hope it helps you 
create one file at the start of the script.
write "app started" like something .
and while closing write "app stopped"
and every time you run the script check for the above text .
i m hoping this solution should be feasible...
Hi Rudic just more thing, you ask if the file lockfile exist in the first line, but what's inside the lockfile?
---------- Post updated at 05:44 PM ---------- Previous update was at 03:58 PM ----------
Thanks one more time!! Pamu, between you and RudiC i've learn a lot, the problem it's fix it cause of you.
The lockfile's sheer existence is the indicator that the app is running. You can leave it empty, or you can put some info about the running instance of your app into it like PID, start time, user, server it runs on, so it can be used for other administrative tasks as well. You have to make sure it disappears once the app stops, even if it is, say, aborted or terminated by a signal.