Shell Scripting Stop/Start Application


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell Scripting Stop/Start Application
# 1  
Old 07-15-2012
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:

Quote:
#!/bin/sh
sh stopServer.sh server1
However it has authentication where username and password prompts will appear after running the above command requiring input from a user. I want to automate the input as though a user was entering it.

I thought echo would work although very rudimentary using echo "password" would pass this value as the output required.

Any advice on what shell command would best suit this would be most helpful.

Thankyou.
# 2  
Old 07-15-2012
You have such a bare bones script example that I cannot give you an example that will solve your problem outright.

You have to use a here document. This is an example - note the placement of the last EOF =- it has to be in the leftmost column.

-- EOF can be any character(s) that the shell will not see as a command or keyword. I used EOF, many coders use !

Code:
#!/bin/sh
/path/to/stop.server.sh << EOF
  username   
  password
EOF

# 3  
Old 07-15-2012
Thank you Jim, I think that will work for what Im trying to do.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 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. Shell Programming and Scripting

Shell Script for Websphere MQ Queue Manager start/stop

Hello All, I am completely new to shell scripting. I had to write a script that starts and stop the queue manager in Websphere MQ. We are on Linux 64-bit patform. The script should stop the queue manager and all the processes related to websphere MQ. It should be a clean stop. Once the queue... (3 Replies)
Discussion started by: pady1224
3 Replies

3. Shell Programming and Scripting

How to stop the process in shell scripting?

Hi all, I have tried the below code to execute. #! /bin/bash date1=`date -d "today 08:00:00" +%s` date2=`date -d "today 08:01:00" +%s` path=/home/user01/red/IDC/sample cd $path java Cspsamp 111.19.5.172 7025 rd1 rd1 "5022=Query|5026=109378|4=627|5=E:VD|5042=$date1|5049=$date2"... (5 Replies)
Discussion started by: aish11
5 Replies

4. Shell Programming and Scripting

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.. Stop making the font size smaller than... (3 Replies)
Discussion started by: testin
3 Replies

5. Shell Programming and Scripting

Shell scripting for application deployment

hi all, i want script for this one 1. Download the zip from the ftp 2. Take backup of the current application 3. Deploy the zip in webapps Unzip the file. 4. Configure DB values. 5. Restart tomcat Thanks Advance, janny. (1 Reply)
Discussion started by: mohan999999
1 Replies

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

7. Shell Programming and Scripting

How to stop monitoring of servers at the time of reboot through shell scripting?

We have number of servers which belongs to platforms Solaris, AIX,HP-UX and LINUX. Monitoring tool 'Patrol Agent' process run on the servers to check for the server health and communicate with the Patrol server through the port 5181. During scheduled reboot and maintenance of servers we do receive... (1 Reply)
Discussion started by: subharai
1 Replies

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

9. Shell Programming and Scripting

Start and stop of an application thru shell scripts.

Hi, I just learnt the shell scripting and got working on that right now. I have one problem. Here i am having a java application that needs to be start and stop using two shell scripts, i.e., starting the java application using one shell script and stopping the application using another... (1 Reply)
Discussion started by: sadha
1 Replies
Login or Register to Ask a Question