respawning script

Hello,

I am trying to migrate a respawn mechanism in CentOS5 to CentOS6. In CentOS5, I had a 'respawn' event in /etc/inittab pointing directly to my script which launched a java process (if script died (caused by death of java process), script got autorestarted). In CentOS6, I understand that I must do this differently. Seems like I have to use Upstart.

After reading some posts on the web, I created the following file: /etc/init/MIL.conf.

Inside of this file I have:

#MIL starter

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn

cd /home/foo/MIL
exec java -jar MIL1.6.jar -port 10005

However when I try to launch this script using:

initctl start MIL

I get…

initctl: Unknown job: MIL

Any advice on the specific problem? More generally?

2 Replies

Don't you need "script" and "end script" around the commands you want to run?

script

cd /home/foo/MIL
exec java -jar MIL1.6.jar -port 10005

end script

sweh,

Yes, that did it!

Thank you very much.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct