Implementing Ctrl +C in a script as a part of automation

Hi,

I am working on Solaris SPARC where we used start the BEA WebLogic Server for some project module. The server is started very simply by changing to its home directory and starting the script called ./startWebLogic.sh. Upto this no big deal.
Once the server get started and comes to runnning mode , the console output is remained. The Shell prompt "-bash-3.00$" does not return. Manually we type Ctrl+C and return to Bash prompt. But know it is the time time to automate the server start, i.e. A script will be doing all stuffs it will change to the home directory and start the server, but problem persists as it does not comes to bash promt after starting the server the script goes on executing it never comes to a halt as matter of fact we are not able to check its execution status. If we run that script with any CI tool say , Hudson it goes on building never stops. we have tried to make it as a back ground process. It did not work. I am not in favor of killing the process as it might affect server functionality. Can we implement the "Ctrl + C" like thing in command that after starting the server it automatically comes to a halt? Waiting for your suggestion. Thanks to all in advance.

Does the script have an exit command?

You may need to source the script:

. ./startWebLogic.sh

Unfortunately saying you've tried isn't the same as saying "look, this is what we've tried (posted code) and this is how it failed (posted error messages and whatnot)". Maybe not what you're looking for, but how about handing off the start command to the 'at' service instead?

Hi Sir,

If I give an exit command in the script it does not executed at all because once the command called ./startWebLogic.sh is encountered the console locks. It not get rids of the command. The script looks like :

#! /bash/bin

do stuff.
ssh username@server "cd directory_of_server/bin; startWebLogic.sh &"

exit 0;

but the shell is not able to execute the exit it locks there only.

When posting code, cut and paste it, do not retype it.

And please wrap it in

 tags.



#! /bash/bin

do stuff.
ssh username@server "cd directory_of_server/bin; startWebLogic.sh &"

exit 0;

but the shell is not able to execute the exit it locks there only.
[/quote]

[indent]
It's not clear what you are trying to do. Perhaps you want:

ssh username@server "cd directory_of_server/bin; startWebLogic.sh" &
ssh username@server "cd directory_of_server/bin;./startWebLogic.sh" &

exactly. That means it executes a command in remote server , changing directory and executing the startWebLogic.sh. Executing remote server is not a problem but how we can come out of this script after executing ./startWebLogic.sh ?
Thanks Sir, for providing the rules as I am a new comer here.

When the script finishes, you are out of it. What's the problem?

Perhaps you need to forget the ampersand (&), and not put it in the background?