Provide Password using to the application using the shell script

Hello,

I have a requirement to shut down and start up my application on different environments (Dev, QA and Prod).

I have around 24 servers. I have to login to each server manually for shutinng down the application.

I wrote a shell command on each server and I am invoking those shell scripts from one server and shutting down.

Here is the issue now. I have problem in shutting down few servers using shell scripts because they need password before it shutdown.

I am executing the shell scripts with root access.

Is there any way that I can issue the password in the Shell itself so that the application will read the password from the shell script itself when it required?

I am new to this forum and LINUX as well. Need help to fix that instance so that my job will become easy

here is the shell script I am using to shut down my node

#!/bin/sh

############################# STOP NODES ###############################################
#stop the node node1
cd /opt/app/node1/bin/
./stopnode1.sh

#########################################################################################

Thanks in advance

Regards,
Raju

You can setup ssh password-less login and remotely invoke your shutdown script like below:-

ssh $user@$host "/opt/app/node1/bin/stopnode1.sh"

I hope this helps.

Hi,

Thank you for your reply.

I have to issue the password to bring down the application. If not the application will never come down. So, password is a mandate for me. This is not a system login password. I have to issue the password while the application is coming down which means this an application specific password.

Thanks in advance

Regards,
Raju