Re: [review request] usr.sbin/service - make showing files configurable
On 05/17/2012 02:51 PM, Bryan Drewery wrote: > Yeah it's what I get for mashing a pseudo example up and not testing it! S'ok, I screwed up ${service##*/} in mine. :) ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [review request] usr.sbin/service - make showing files configurable
On 5/17/2012 4:37 PM, Doug Barton wrote: > On 05/14/2012 06:35, Bryan Drewery wrote: > > >> On 5/13/2012 6:15 PM, Doug Barton wrote: >>> On 5/12/2012 8:23 PM, Bryan Drewery wrote: Hi, I found service(8) to be inconsistent that it listed files with `service -e`, but plain services with `service -l` > >>> That behavior is by design. > > > >> Could you please elaborate on the design decision? > > For services that are enabled (IOW, a tiny subset of the overall > number) I thought it was useful to indicate to the user where those > services come from. The -l option dumps everything in the directories, > even if it's not a service. Users interested in differentiating > /etc/rc.d from $local_startup can use ls. Thanks for explaining. > >> I did of course look in base for uses of service -e and service >> -l, before considering this patch. The only case I can find is in a >> cshrc example, which my patch does not affect. > > That's not relevant, as you cannot possibly know what other uses > service(1) is being put to. Also, it's bad form to change the default > output of a tool (and/or the semantics of its command line options) > years after its introduction. True. > >> I had expected service -e to behave like service -l, so I could >> for example, put it into a loop and check all services, using the >> service(8) script itself. > >> for service_name in `service -e`; do service status $service_name >> || service start $service_name; done > > for service in `service -e` ; do > service ${##*/service} status || service ${##*/service} start > done Yes, I resorted to that before the patch. I just think consistency is better. > > (Note, your syntax for the service command is wrong above.) Yeah it's what I get for mashing a pseudo example up and not testing it! > > > hth, > > Doug > Thank you, Bryan Drewery ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [review request] usr.sbin/service - make showing files configurable
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 05/14/2012 06:35, Bryan Drewery wrote: > > > On 5/13/2012 6:15 PM, Doug Barton wrote: >> On 5/12/2012 8:23 PM, Bryan Drewery wrote: >>> Hi, >>> >>> I found service(8) to be inconsistent that it listed files with >>> `service -e`, but plain services with `service -l` > >> That behavior is by design. > > > > Could you please elaborate on the design decision? For services that are enabled (IOW, a tiny subset of the overall number) I thought it was useful to indicate to the user where those services come from. The -l option dumps everything in the directories, even if it's not a service. Users interested in differentiating /etc/rc.d from $local_startup can use ls. > I did of course look in base for uses of service -e and service > -l, before considering this patch. The only case I can find is in a > cshrc example, which my patch does not affect. That's not relevant, as you cannot possibly know what other uses service(1) is being put to. Also, it's bad form to change the default output of a tool (and/or the semantics of its command line options) years after its introduction. > I had expected service -e to behave like service -l, so I could > for example, put it into a loop and check all services, using the > service(8) script itself. > > for service_name in `service -e`; do service status $service_name > || service start $service_name; done for service in `service -e` ; do service ${##*/service} status || service ${##*/service} start done (Note, your syntax for the service command is wrong above.) hth, Doug - -- This .signature sanitized for your protection -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJPtW+MAAoJEFzGhvEaGryEpokH/RbWnJZN/RCQzidxoIbAx0+5 nAEX33e0Iazfqs/km7uFP8T/4SD2b0pOmr3dNBaKHqnpz005ACzhTcWD111ik/d2 ypRKdzh+vlq+Y9bDB4PozMjnalZrhkAUIinUIDDH6xMW46fIbN2bXPqz8AIe1Umo a8LaHW59ARJf197o7iyWNOYOcF6+S3haaSzu8UXL5MTDtKBpn5XY5Eg6ppc/ZD9J Mzaq1k7baCrGqCSsyZusmCv7WWDcOw7tOspUKzoNMm+wBMf7MrQyPUQsaA9vfGXZ cB39Byryvi9Rhbz/ACjgw44ZRVUcjWJaxkFVc5WwkLbCDTv4tny5q2KpIAHfhPk= =ykfV -END PGP SIGNATURE- ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [review request] usr.sbin/service - make showing files configurable
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/13/2012 6:15 PM, Doug Barton wrote: > On 5/12/2012 8:23 PM, Bryan Drewery wrote: >> Hi, >> >> I found service(8) to be inconsistent that it listed files with `service >> -e`, but plain services with `service -l` > > That behavior is by design. > Could you please elaborate on the design decision? I did of course look in base for uses of service -e and service -l, before considering this patch. The only case I can find is in a cshrc example, which my patch does not affect. I had expected service -e to behave like service -l, so I could for example, put it into a loop and check all services, using the service(8) script itself. for service_name in `service -e`; do service status $service_name || service start $service_name; done Of course this doesn't work as -e returns files. /etc/rc.d/ntpd does not exist in /etc/rc.d or the local startup directories (/usr/local/etc/rc.d) This may be a poor example, but it's something I tried and was surprised by not working. My patch allows for the old behavior of listing the file, but improves it so now -e -l and -r all support showing files by specifying -F, while without, it just lists the service names. I consider this change to be fairly trivial since -e doesn't appear to be used anywhere currently. > Thanks for your interest, > > Doug > Regards, Bryan Drewery -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJPsQobAAoJEG54KsA8mwz55UcP/3m/6JnfNauEBr4/YB+fClyq 0+q6qkZIue7iXvZKxbE86Zyg4PxBMEvsteVrqZHSwSbwJmvrRj8o1aQkKS2FDgjW 0urKhNnzY2nd5cgDfE9HLSsg9gm25KWbVEcPKNhY5ru8BltRaLQ4V5XGu5XIsxYM E2660rX71q1+GgjuU4TqKUj3m/PjNeAw37uwJTvhmWwP2EK8Aw3zOfipQAsYo4ng ehha1gG0y6fqK44hlgr/SByiGmcN2+5OxCFQp/GFCwvVjXIUTnMN0xLs77GN1/S6 P4yMz6bE605uEaHQfbyPminfE/5t5Zisr9ctk4Vckwj+ixHetcVEa692NXGb5YwP +WygJ6HJk7pwJnQwjFwXUSKJSA/Iy0ktXBaJDawLZWAKl2CuADq9H6fnOqdTJWF2 tgXYufvuWNzCmdfW+kOuDbzUxcUcK/GMN5y4z41Ee245h/GQ5otECD/lybeBwnZF S90Hpc8nuctedDw5GuisQMBNNOfctdl/gRL+zmLIEDD7lzO90bz6bJlUMZt2Umzq 1vou2brIpMqmN+ci1PMSpXRIRufXSHOAPRzfPOORYZWb7t51C173YjwFt6Zkk6nt WKXVQzM9oArfClAUilVbiqlq4PSMVh/9iCTZSsNrNWRiPjIpapxAIlXg/idgxTZA YX6eL2j3vXWahCP0PKtP =woA8 -END PGP SIGNATURE- ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [review request] usr.sbin/service - make showing files configurable
On 5/12/2012 8:23 PM, Bryan Drewery wrote: > Hi, > > I found service(8) to be inconsistent that it listed files with `service > -e`, but plain services with `service -l` That behavior is by design. Thanks for your interest, Doug -- This .signature sanitized for your protection ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"