Per the init system documentation: ... The RESTART option
Per the init system documentation: ... The RESTART option The service must be started for RESTART to work... ... The current implementation unconditionally starts the service. Reproducible: Always Steps to Reproduce: 1. /etc/init.d/stopped_service restart Actual Results: Stopped service gets started. Expected Results: Not started service.
Created attachment 23515 [details] Modified svc_restart in runscript Maybe the error message should suggest running service start?
Ooops. I meant to say that I'd modified runscript.sh so that this error is no longer reproducible. The modified script (Attached) gives: /etc/init.d/<stopped service> restart * status: not started stopped service remains stopped
The docs is just outdated. restart will start the service if not.
Regarding comment #3. I'd prefer the behavior stay as currently documented. I have scripts that I've written that restart certain services on a network transition event( net up/down, change IP, etc. ), and it's a lot more natural to do a 'service restart' in a shell script than 'if [ ps axcocommand,pid | grep service ]...'
Here is what I see in the output of /sbin/runscript. Could you please point to the "init system documentation" to which you're referring? restart Restart service, as well as the services that depend on it. Note to developers: If this function is replaced with a custom one, 'svc_start' and 'svc_stop' should be used instead of 'start' and 'stop' to restart the service. This is so that the dependencies can be handled correctly. Refer to the portmap rc-script for an example.
The quote was from rc-script.xml, which was the original documentation on this stuff( marked up version can be found in CVS here http://www.gentoo.org/cgi-bin/viewcvs.cgi/en/Attic/rc-scripts.xml rev=1.10&root=doc&content-type=text/vnd.viewcvs-markup ) The RESTART option The service must be started for RESTART to work. It will restart the service as well as all the services that depend on it. ... It seems svc_restart() functionality has been re-defined since then. I can live with this. It would be nice to have a simple way of saying 'restart if started, leave alone otherwise' for network-location sensitive services running( or not ) on a laptop.
aron: makes sense to me ... is there any real reason we need the current behavior instead of the old one ?
please attach a patch
Roy: how do you feel about this ? current behavior is for `/etc/init.d/s restart` to start service 's' if it isnt running and to restart otherwise ... the bug is requesting we change the behavior to only restart if 's' is running, not to start it if it isnt running
I can see both sides of the argument. However, I cannot find any Gentoo documentation suggesting what the behaviour should or should not be (the refernced xml looks lost as we now use a svn repo). However, I kinda like the current implementation. To me, a restart implies that you want the service started with a new configuration. The fact the it's currently stopped is irrelevant to the end result. Seeing as the majority of baselayout developers seem to share the same view, I'll mark this as INVALID.