Shell Scripting.... How to start a same script in 3 different logins?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Scripting.... How to start a same script in 3 different logins?
# 1  
Old 12-13-2011
Data Shell Scripting.... How to start a same script in 3 different logins?

Hi,

I’ve a shell script. If I trigger the script it takes one day to complete the execution.

I’ve to start the same script in 3 different logins of Unix machine simultaneously. Do you have any idea how can I make it? Please suggest.


Thank you..

Moderator's Comments:
Mod Comment Stop making the font size smaller than it is by default, thanks.

Last edited by zaxxon; 12-14-2011 at 11:34 AM.. Reason: font size
# 2  
Old 12-13-2011
At the start of the script:

Code:
while [ -f /tmp/lockfile ] ; do true ; done

Either as root, or as a user configured in sudo to run this script as these users:

Code:
touch /tmp/lockfile
for USERNAME in user1 user2 user3
do
        sudo -u "$USERNAME" nohup /path/to/script.sh &
done

disown # Needed in bash/ksh, maybe not other shells

sleep 1

rm /tmp/lockfile # Let all three scripts start running simultaneously

# 3  
Old 12-14-2011
Hi,

Thanks a lot for the reply...

But it did not workout... I don't know what went wrong but the script did not get executed.

Please suggest if there are any other idea...


---------- Post updated at 02:24 PM ---------- Previous update was at 01:13 PM ----------

Hi,

One more challenge is that, I am supposed to run a same script 3 times simultaneously but with 3 different command line inputs.

Please advise.

Thank you in Advance...


---------- Post updated at 02:25 PM ---------- Previous update was at 02:24 PM ----------

Hi,

One more challenge is that, I am supposed to run a same script 3 times simultaneously but with 3 different command line inputs.

Please advise.

Thank you in Advance...
# 4  
Old 12-14-2011
You agreed not to bump posts when you registered. We are not 'on call'. If you don't get an answer immediately, wait!

Doing it with 3 different sets of commandline option is a trivial change to my code. Remove the loop and just do 'sudo' 3 times.

In what way did it "not work"? Did you set up sudo properly first as mentioned?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to stop and start server

Hi, I need to create a shell script for automated server patching, with the following scenario: I have two Linux servers Primary and secondary. Server patching should start on Primary 1st and then secondary. 1st check both servers are up and running. Then stop primary and patching will... (1 Reply)
Discussion started by: rcroyal88
1 Replies

2. UNIX for Beginners Questions & Answers

How to start a Shell Script in a VirtualBox(Ubuntu)?

Hi,so today is my first day with linux. I have some scripts from a friend and now im trying to run them but it doesnt work. So what i tried is: -Moved the scripts to a specific directoy (into my document folder) -then i opened the standard terminal in ubuntu (GNOME-Terminal) -i typed in "Ls",... (3 Replies)
Discussion started by: easy123
3 Replies

3. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

4. UNIX for Dummies Questions & Answers

Shell Scripting Stop/Start Application

I did a search of these forums but couldnt find a suitable resolution. I am attempting to script a stop and start of an application on AIX. Such as: However it has authentication where username and password prompts will appear after running the above command requiring input from a... (2 Replies)
Discussion started by: Soupy
2 Replies

5. Shell Programming and Scripting

Emergency...!!! Shell Scripting.... How to start a same script in 3 different logins?

Hi, I've a shell script. If I trigger the script it takes one day to complete the execution. I've to start the same script in 3 different logins of Unix machine simultaneously. Do you have any idea how can I make it? Please suggest.:( Thank you.. (1 Reply)
Discussion started by: testin
1 Replies

6. UNIX for Dummies Questions & Answers

unable to start shell script

Hi, Pleasse could someone advise why i'm getting this error below - No such file or directory dev6:$ ls -ltr ReleaseManagement.sh -rwxr-xr-x 1 dev fix 4830 Aug 22 11:13 ReleaseManagement.sh dev6:$ ./ReleaseManagement.sh : No such file or directory dev6:$ thank you (2 Replies)
Discussion started by: venhart
2 Replies

7. Shell Programming and Scripting

My PM has told me to learn shell scripting in 2 weeks , how should I start?

My PM has told me to learn shell scrting in 2 weeks , how should I start?:confused::confused::confused::confused: (1 Reply)
Discussion started by: manalisharmabe
1 Replies

8. Shell Programming and Scripting

Help with shell script which logins to hosts

By a shell script When I am logging into hosts one by one with ssh. I am getting below message. Pseudo-terminal will not be allocated because stdin is not a terminal. stty: : Invalid argument stty: : Invalid argument Can you please suggest what should I do to stop this? ... (10 Replies)
Discussion started by: KuldeepSinghTCS
10 Replies

9. Shell Programming and Scripting

Help with stop/start Shell Script.

Hi All, I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task. 1. User will input the option which server they wish to stop. 2. Will clear cache files from specific location. 3. ... (1 Reply)
Discussion started by: venga
1 Replies

10. Shell Programming and Scripting

want to start shell scripting

I have knowledge in Linux RHEL 5 system & Network Administration topics. I want to know shell scripting. Please guide me to get a good start. (1 Reply)
Discussion started by: subrata
1 Replies
Login or Register to Ask a Question