Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

init.d scripts

Status
Not open for further replies.

stu78

Programmer
May 29, 2002
121
GB
Hi,

I am writing a script ( start & kill ) for an application. When I test this as follows;

cd /etc/init.d
./Sapp98 start

It works fine but does not put the job in the background - i.e the job remains in the foreground;

Here is the script;

************************************************************
case "$1" in
'start')
su - user -c /opt/application/ExecAS/`hostname`/Start &
;;

esac
************************************************************

What could be causing this?
 
CAn you explain a little more what you mean by 'the job remains in the foreground', ie do you get a prompt back when you run the script and is the app listed in a ps -ef listing? Incidentally, you'd probably be better calling your script S98app rather than Sapp98, thus following the standard init.d convention.
 
Hi Ken,

Correct the JOB runs - however does not return the prompt to me....

Typo in the name - I can change.

I have narrowed down my problem, basically to explain;

This is an start/kill wrapper script for another vendor supplied script. This script does not return the prompt - mine is fine!!!!

Here is the culprit part of the script;

cd $ROOT; $CMD


the $CMD piece does not return the prompt - it dumps a lot of info on to the terminal.

Do you have any ideas how to get this to put this in the background ( I have tried & etc )


 
What are $ROOT and $CMD set to within the script? Approximations will do if necessary.
 
Hi Ken,

This is JCMD;

JCMD="$JR -$OPTS -classpath $CLASSPATH -add "/test=/opt/test/test/""

I have tried adding an &, but no good...
 
Hi stu78,

Can I suggest using nohup - see the man pages.
eg:
cd $ROOT; nohup $CMD &

I hope that helps.

Mike
 
Thanks Mike,

However, now I am wondering if the problem is running the script from the /etc/init.d directory ( this is a more general question ).

Should scripts ran here return the user to the prompt? Usually I have to hit return before I get prompt???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top