Cannot see my upstart job via initctl list

General support questions
Post Reply
jacek99
Posts: 1
Joined: 2013/07/01 19:37:54

Cannot see my upstart job via initctl list

Post by jacek99 » 2013/07/01 19:45:37

I've installed a new RPM for an in-house app we've created.

It has an upstart conf script in

[quote]/etc/init/myapp.conf[/quote]

I reloaded the initctl configuration.

[quote]sudo initctl reload-configuration[/quote]

but my job still does not show in the list. If I try to do start it....

[quote]
sudo initctl start myapp
initctl: Unknown job: myapp
[/quote]

what could I be possibly doing wrong here? Been banging my head against this for an hour.

I am running CentOS 6.4 in a VirtualBox VM created via Vagrant / Chef.

Thanks in advance...

P.S. In case it is important, here's the actual upstart file

[quote]
description "My App"

start on startup
stop on shutdown

env JAVA_HOME="/usr/lib/jvm/jre-1.7.0"
env ROOT_DIR="/opt/myapp"
env JVM_OPTIONS="-Xms64m -Xmx1024m"

# change this user if required
setuid jacek99
respawn

script
chdir $ROOT_DIR
exec $JAVA_HOME/bin/java $JVM_OPTIONS -jar -server myapp-standalone.jar server etc/myapp.yml
emit myapp_running
end script
[/quote]

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Cannot see my upstart job via initctl list

Post by gerald_clark » 2013/07/01 22:33:37

'env' ?
Perhaps you mean 'export'.

User avatar
jlehtone
Posts: 2127
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Cannot see my upstart job via initctl list

Post by jlehtone » 2013/07/03 07:43:21

I had not even noticed the '/etc/init' and 'initctl' before, so I peeked into /etc/init/* and they do use [b]env[/b].

All the custom services that I have, are in '/etc/init.d' and managed with 'chkconfig'.

I presume that the difference is that the /etc/init are automatically restarted should they stop?

ahunt
Posts: 1
Joined: 2014/03/07 21:29:15

Re: Cannot see my upstart job via initctl list

Post by ahunt » 2014/03/07 21:48:50

The version of upstart that comes with current version CentOS is pretty old (v0.6.5), and doesn't support a lot of commands including setuid. If something in your script isn't recognized, you won't receive a syntax error. Your job just won't be listed when you run "initctl list". When you try to start your job, you'll get an "Unknown job" error. There is a tool to check your upstart script for errors (init-checkconf), but it doesn't work with this version.

To run a command as a user other than root, use su or sudo rather than setuid.

Code: Select all

description "My App"

start on startup
stop on shutdown

env JAVA_HOME="/usr/lib/jvm/jre-1.7.0"
env ROOT_DIR="/opt/myapp"
env JVM_OPTIONS="-Xms64m -Xmx1024m"

# change this user if required
env USER=jacek99
respawn

script
chdir $ROOT_DIR
exec su -c "$JAVA_HOME/bin/java $JVM_OPTIONS -jar -server myapp-standalone.jar server etc/myapp.yml" $USER
emit myapp_running
end script

drk
Posts: 397
Joined: 2014/01/30 20:38:28

Re: Cannot see my upstart job via initctl list

Post by drk » 2014/03/07 22:58:17

etc/myapp.yml
Is there supposed to be a leading "/" on that or is it relative to $ROOT_DIR?

Post Reply