[Bug 552786] Re: initctl: lacks proper exit codes
David Britton
david.britton at canonical.com
Fri Jul 12 18:02:00 UTC 2013
The following patch to service fixes it for precise. This may not be
the most graceful, but this bug is really annoying. Could we get
something pushed through?
121c121,128
< start|stop|status|reload)
---
> status)
> # Make sure status only succeeds in the started case
> result=`${ACTION} ${SERVICE} ${OPTIONS}`
> echo $result
> echo "$result" | grep -q "start/waiting"
> exit $?
> ;;
> start|stop|reload)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/552786
Title:
initctl: lacks proper exit codes
Status in Upstart:
Triaged
Status in “upstart” package in Ubuntu:
Invalid
Bug description:
Binary package hint: upstart
Puppet currently lacks knowledge of Upstart, so continues to operate
on everything via the legacy sysvinit init scripts.
Puppet optionally can be told that the init script supports a "status"
parameter, and then expects the init script to exit non-zero, per LSB
3.1
Currently, a service is using an Upstart job, but has the legacy
initscript interface, the "status" parameter exits 0, regardless of
the state of the service.
For example (using Lucid):
$ sudo /etc/init.d/gssd status
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service gssd status
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the status(8) utility, e.g. status gssd
gssd start/running, process 24250
$ echo $?
0
$ sudo /etc/init.d/gssd stop
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service gssd stop
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop gssd
gssd stop/waiting
$ sudo /etc/init.d/gssd status
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service gssd status
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the status(8) utility, e.g. status gssd
gssd stop/waiting
$ echo $?
0
Compare this with Postfix, which is not using Upstart:
$ echo $?
0
$ sudo /etc/init.d/postfix status
* postfix is not running
$ echo $?
3
$ sudo /etc/init.d/postfix start
* Starting Postfix Mail Transport Agent postfix [ OK ]
$ sudo /etc/init.d/postfix status
* postfix is running
$ echo $?
0
There are similar issues with the Upstart-provided utilities:
$ sudo status gssd
gssd stop/waiting
$ echo $?
0
$ sudo service gssd start
gssd start/running, process 28011
$ sudo status gssd
gssd start/running, process 28011
$ echo $?
0
Obviously only services that have Upstart jobs are visible via this
interface.
To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/552786/+subscriptions
More information about the foundations-bugs
mailing list