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..

At the start of the script:

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

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

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

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...

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?