Re: init.d startup script does not exit



On Sunday 14 September 2008 09:12:35 rex wrote:
Thank you! It worked!

So, what does that & mean?

- Rex

Clifford W. Hansen wrote:
On Sunday 14 September 2008 08:35:13 rex wrote:
Hello,

I have a script that launches a program. If I launch this program
manually, it keeps on running in the shell. It is a webserver, so I
need it running all the time. However, if I exit the shell, it kills
the webserver.

I tried putting links to it in the rc0.d, rc1.d etc to make it start
during startup, but it keeps on going during startup and never starts
the other services.

here is my script in /etc/init.d/coldfusion

#!/bin/sh -e
sAppName="ColdFusion 8"
sUser=cfuser
COLDFUSION_HOME=/opt/jrun4
case "$1" in
start)
echo "Starting ${sAppName} as user $sUser..."
su ${sUser} -c "$COLDFUSION_HOME/bin/jrun -start instance01"
exit 0
;;
stop)
echo "Stopping ${sAppName}..."
su ${sUser} -c "$COLDFUSION_HOME/bin/jrun -stop instance01"
;;
restart)
echo "Restarting ${sAppName}..."
su ${sUser} -c "$COLDFUSION_HOME/bin/jrun -restart instance01"
;;
status)
su ${sUser} -c "$COLDFUSION_HOME/bin/jrun -status instance01"
;;
*)
echo "usage: /etc/init.d/coldfusion {stop|start|restart|status}"
exit 1
esac
exit 0
###### EOF

When I run #/etc/init.d/coldfusion start, it displays the startup
messages, until it hits:

09/13 23:31:40 info Deploying EJB "JRunSQLInvoker" from:
file:/opt/jrun4/lib/jrun-comp.ear
Server instance01 ready (startup time: 23 seconds)

and then the program/cursor is just there, waiting... forever...

It does not exit. If this was in the startup, I would never get to the
user login.

And, if I press Ctrl-C, then the program terminates, but then webserver
is dead.

Any suggestions please?

Thanks!

- Rex

Rex,

I'm not sure if there is a better way to do this, but you could try
adding a & at the end of the start line:
su ${sUser} -c "$COLDFUSION_HOME/bin/jrun -start instance01" &

HTH

It's used to background a process see:
http://www.google.co.za/search?q=linux+job+control&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
http://linuxreviews.org/beginner/jobs/

But I agree with Tzafrir, use the start-stop-daemon program. If anything it
sounds better than backgrounding a process.

And thank you Gabriel I belive you are correct the & should be before the "
and not after it... ;)

HTH
--
Thank you,

Clifford W. Hansen
PHP Developer / Linux Administrator

(Cell) +27 82 883 8677
(Fax) +27 86 503 0634
(E-Mail) clifford@xxxxxxxxxxxxxxx
(MSN) clifford@xxxxxxxxxxxxxxx
(GPG) 0x936D6C19

"We have seen strange things today!"

() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments

Attachment: signature.asc
Description: This is a digitally signed message part.



Relevant Pages

  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)
  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)
  • Re: XP Hangs Using Shutdown Scripts
    ... I can see you would have problems on shutdown as windows may well ... shutdown before the script finishes if there are a lot of files. ... It should run ok if you create a cmd file and add it to the startup ... I have tried with both an EXIT, ...
    (alt.os.windows-xp)
  • Re: ActiveX Script Automation - Guidance Needed
    ... startup. ... Set that script to call your import script in the main file, ... I used Exit Application because this opener file has to run on the ... Citrix server. ...
    (comp.databases.filemaker)
  • Re: EventID 1054 from Userenv for startup script
    ... The policy folder containing the ... I added Authenticated Users to script folder ACL with Read & Execute ... but it still didn't run at startup. ... It obviously gets group policy ...
    (microsoft.public.windows.group_policy)