[SOLVED] How can i control the same app in two servers?


 
Thread Tools Search this Thread
# 1  
Question [SOLVED] How can i control the same app in two servers?

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 .
# 2  
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.
This User Gave Thanks to RudiC For This Post:
# 3  
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. Smilie
This User Gave Thanks to pamu For This Post:
# 4  
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.
# 5  
Sth. like
Code:
[ -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...

Last edited by RudiC; 09-06-2012 at 02:51 PM.. Reason: forgot to create the file...
This User Gave Thanks to RudiC For This Post:
# 6  
ok.

one quick one.
hope it helps you Smilie

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...
This User Gave Thanks to pamu For This Post:
# 7  
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.
This User Gave Thanks to Newer For This Post:
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Removing control-m characters from shell script

Hi All, I need to remove control m character from a file. Steps which i am doing in shell script are: 1) We are comparing the header of the file to the database table header Here the file header has control-m characters. How do i remove it. Please help. Below are the steps i am using,... (12 Replies)
Discussion started by: abhi_123
12 Replies

2. Solaris

Problem with /app

Hi folks, i have a problem with my /app directory on solaris 10.It is mounted under rpool root and sometimes it increase dimension bringing root out of space.I want to mount /app under different position, maybe under secondary hardisk for which i have created a mount point with zfs pool...How... (10 Replies)
Discussion started by: mattpunk
10 Replies

3. Emergency UNIX and Linux Support

[Solved] DCMU (disk control and monitor utility) sun fire

Hi , during 2 weeks ive been trying to find them. i need DCMU packets for managing internal disks on sun fire x4500 and sun fire x4600 on rhel. i have opened to tickets to myoraclesupport but no answer. please anybody could tell me a link or anythiing?? ive been searching and searching... (1 Reply)
Discussion started by: pabloli150
1 Replies

4. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

5. Solaris

luminis app

The guys at SunGard want to charge a lot of $$$$ for installing Luminis and we are trying to see if this can be done without them. Their installation guide provided page #53 ( http://www.luminis.nocccd.edu/documents/Luminis%20IV/lp40000in.pdf ) doesn't really tell you much. All they say is that... (4 Replies)
Discussion started by: ceci1
4 Replies

6. Programming

Deadlocked App

Hello All - We have a legacy C program running non stop on one of our servers, with several instances often running at once. Fairly regularly, one of the instances while stop outputting to the log file and will just deadlock/hang. They must be then 'kill'ed by myself. When I gdb into one of... (3 Replies)
Discussion started by: markanderson
3 Replies

Featured Tech Videos