upstart fail to run service and not able to debug

asked 2014-11-06 01:40:51 -0600

lafada gravatar image

I am using os-svc-daemon to create my upstart service for openstack project.

my upstart job config is as below

File : /etc/init/myservice.conf

start on runlevel [2345]
stop on runlevel [016]


env OS_SVC_ENABLE_CONTROL=1
export OS_SVC_ENABLE_CONTROL

pre-start script
  mkdir -p /var/run/myservice
  chown -R root:root /var/run/myservice
end script

respawn
# the default post-start of 1 second sleep delays respawning enough to
# not hit the default of 10 times in 5 seconds. Make it 2 times in 5s.
respawn limit 2 5

exec start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myservice --

post-start exec sleep 1

This service run as root user.

If i run start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myservice then its working fine.

But when I check status using

~# initctl start myservice
myservice stop/starting

~# initctl status myservice
myservice stop/waiting

I also tried Debuging

start on runlevel [2345]
stop on runlevel [016]


env OS_SVC_ENABLE_CONTROL=1
export OS_SVC_ENABLE_CONTROL

pre-start script      
  mkdir -p /var/run/myservice
  chown -R root:root /var/run/myservice
end script

script
  echo "DEBUG: `set`" >> /tmp/myjob.log

  # rest of script follows...
end script    

respawn
# the default post-start of 1 second sleep delays respawning enough to
# not hit the default of 10 times in 5 seconds. Make it 2 times in 5s.
respawn limit 2 5

exec start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myservice --

post-start exec sleep 1

But it's not create file in /tmp

edit retag flag offensive close merge delete