Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37742 - runscript.sh: svc_restart() starts stopped services
Summary: runscript.sh: svc_restart() starts stopped services
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-09 14:18 UTC by Matt Darland
Modified: 2005-11-28 06:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modified svc_restart in runscript (runscript.sh,12.05 KB, text/plain)
2004-01-09 14:58 UTC, jon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Darland 2004-01-09 14:18:16 UTC
Per the init system documentation:
...
The RESTART option
Comment 1 Matt Darland 2004-01-09 14:18:16 UTC
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.
Comment 2 jon 2004-01-09 14:58:00 UTC
Created attachment 23515 [details]
Modified svc_restart in runscript

Maybe the error message should suggest running service start?
Comment 3 jon 2004-01-09 18:20:21 UTC
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

Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-11 11:27:09 UTC
The docs is just outdated.  restart will start the service if not.
Comment 5 Matt Darland 2004-01-12 06:12:17 UTC
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 ]...'
Comment 6 Aron Griffis (RETIRED) gentoo-dev 2004-08-01 17:43:45 UTC
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.
Comment 7 Matt Darland 2004-08-02 10:32:15 UTC
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.
Comment 8 SpanKY gentoo-dev 2004-10-03 00:35:24 UTC
aron: makes sense to me ... is there any real reason we need the current behavior instead of the old one ?
Comment 9 SpanKY gentoo-dev 2004-10-06 06:03:41 UTC
please attach a patch
Comment 10 SpanKY gentoo-dev 2005-11-27 10:12:14 UTC
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
Comment 11 Roy Marples (RETIRED) gentoo-dev 2005-11-28 06:48:27 UTC
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.