Run Linux command as predefined user
- by vijay.shad
Hi all,
I have created a shell script to start a server program.
startup.sh start
When above command will executes, it will try starts the server as adminuser. To achieve this my script has written like this.
SUBIT="su - adminuser -c "
SERVER_BOX_COMMAND_A="Server"
##############
# Function to start cluster
function start(){
$SUBIT "$SERVER_BOX_COMMAND_A"
}
When i execute the command it asks for password. Is there any other way to do this so, it will not ask for password.
I have seen this behavior in Jboss startup script provided on jboss. That script changes the user to jboss and then starts the jboss server. I wanted my script to behave same way.