How to include RETURN KEY with Background process "&" in Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to include RETURN KEY with Background process "&" in Shell Script
# 1  
Old 03-11-2008
How to include RETURN KEY with Background process "&" in Shell Script

Hello All,

I am a newbie in Shell script programming, and maybe you can help me with my query.

I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script.

The mntServer.ksh script contains:

#!/bin/ksh
/home/test/bin/squishserver &
/home/test/bin/inst_feature_test.ksh

However, when I run the mntServer.ksh script, it seems to just hang when the squishserver & process is being started and it doesnt continue to execute the next command on the script which is inst_feature_test.ksh.

# ./mntServer.ksh
Port: 4322


If I execute the squishserver & in command prompt, I need to press enter to go back to command prompt.

Is there a way I can incorporate a Return key in the shell script so that I can successfully start the squishserver & command and all the succeeding commands after it?


Thanks a lot in advance.


racbern
# 2  
Old 03-11-2008
You can do like this

#!/bin/ksh
/home/test/bin/squishserver > /dev/null 2>&1 &
/home/test/bin/inst_feature_test.ksh


Redirecting the output of squishserver to the desired output files. Can be /dev/null or any other output file you can give.

I hope that will help.

Sanjay
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (14 Replies)
Discussion started by: thisissouvik
14 Replies

2. AIX

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (2 Replies)
Discussion started by: thisissouvik
2 Replies

3. Shell Programming and Scripting

[SOLVED] Using "$!" to get the PID of the Last Ran Background Process

Hello All, I was looking into creating a script that would be used only to start a Daemon and create a lock file... F.Y.I. It's for Nagios' NRPE Daemon Plugin... Anyway when I run the command to start the Daemon (below): /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d And... (14 Replies)
Discussion started by: mrm5102
14 Replies

4. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

5. Shell Programming and Scripting

read -n1 -r -p "Press..." key / produces error in bash shell script

Hello! Sorry, for my not so perfect english! I want to stop bash shell script execution until any key is pressed. This line in a bash shell script read -n1 -r -p "Press any key to continue..." key produces this error When I run this from the command line usera@lynx:~$ read... (4 Replies)
Discussion started by: linuxinho
4 Replies

6. Shell Programming and Scripting

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/tmp/log & In script A it calls B directly, without any redirecting or nohup or background. However A is always "Stopped", while B is running correctly. Anybody knows why? thanks! -----Post Update----- BTW, if I don't use nohup... (4 Replies)
Discussion started by: meili100
4 Replies

7. UNIX for Advanced & Expert Users

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/tmp/log & In script A it calls B directly, without any redirecting or nohup or background. However A is always "Stopped", while B is running correctly. Anybody knows why? thanks! -----Post Update----- BTW, if I don't use nohup... (1 Reply)
Discussion started by: meili100
1 Replies

8. Shell Programming and Scripting

Shell script process remains after "exit 1"

I have a script that performs an oracle export: <snip> if then exp / full=y file=${exp_file} log=${exp_log} direct=y feedback=1000000 STATISTICS=NONE buffer=20000000 else exp / full=n owner=${schema_name} file=${exp_file} log=${exp_log} direct=y feedback=1000000... (4 Replies)
Discussion started by: Squeakygoose
4 Replies

9. Shell Programming and Scripting

ksh script as a login shell return "no controlling terminal"

I have created a ksh shell script and used it as a login shell for a user. </etc/passwd> lramirev:x:111:200:Luis:/export/home/menush:/usr/local/menush/menush My shell script is like this: </usr/local/menush/menush> #!/bin/ksh # if ] then . $HOME/.profile fi ... (8 Replies)
Discussion started by: lramirev
8 Replies

10. Shell Programming and Scripting

shell script & sqlplus "plzz help"

hi friends, i m tryin to load data from one set of table to other i have sql procedure al ready for it..! i m going to load the procedure only if data in one of my table for example table "landing " have 10 records each attribute of this table is file_name status date ... (2 Replies)
Discussion started by: kulbir
2 Replies
Login or Register to Ask a Question