Why isn't a stopped service started by a call to restart?

Asked by Jeffrey Wildman

'man initctl' states the following about the Upstart command 'restart':

>> Note that this command can only be used when there is an instance of JOB, if there is none then it returns an error instead of starting a new one.

However, for example, calling '/etc/init.d/idmapd restart' when idmapd is originally stopped will result in idmapd being started without an error. This is different from the behavior of 'restart'.

What makes this somewhat confusing is that some /etc/init.d/ scripts (like idmapd in my case) will emit a warning declaring their conversion to Upstart and refer users to use 'service idmapd restart' instead. 'service' relies on 'restart' to perform the restart and thus behaves differently from the original /etc/init.d/ script. I don't seem to be the only one:

https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/594850
https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/440179

So, my questions are:

1. Is there a particular reason why the command "restart $SERVICE" does not duplicate the behavior of "/etc/init.d/$SERVICE restart"?
2. Should there be a wishlist/bug for package upstart? Or does this remain a bug report for package sysvinit? (sysvinit provides the command 'service')

Thanks in advance.

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu upstart Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

The command will be:

sudo service $SERVICE restart

assuming $SERVICE has 'restart', otherwise you will need to run:

sudo service $SERVICE stop; sudo service $SERVICE start

Same deal.

Revision history for this message
Jeffrey Wildman (jeffrey-wildman) said :
#2

I'm not sure that it's a matter of whether or not the service in question supports 'restart'. 'restart''s documentation specifically states that it won't start a stopped service.

For example, calling:

>sudo service $SERVICE stop; sudo service $SERVICE restart

produces the following error message from 'restart':

>restart: Unknown instance:

I agree that calling:

>sudo service $SERVICE stop; sudo service $SERVICE start

will accomplish what I'm looking for (making sure $SERVICE is running, regardless of its initial state), but isn't restart supposed to do as well?

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.