0

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

Nilesh
  • 255
  • 1
  • 6
  • 17
  • Does your service fork? Why are you using start-stop-daemon when you can just use the normal `exec /opt/stack...`? – CameronNemo Nov 17 '14 at 22:57
  • @CameronNemo, I found the problem, there is `os-svc-enable` command to enable service. If service is not enable then it will not run the upstart. – Nilesh Nov 18 '14 at 03:12

0 Answers0