Date: Tue, 9 Jun 2009 18:02:14 -0400 From: Edwin Shao <poleris@gmail.com> To: RW <rwmaillists@googlemail.com> Cc: ports@freebsd.org Subject: Re: Port of "service" command Message-ID: <17ca67550906091502x93b6d2csdb39019e00f21c73@mail.gmail.com> In-Reply-To: <20090609221656.752e9c8f@gumby.homeunix.com> References: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com> <1d3ed48c0906091140t37fbdd4eq84a1153348db7a53@mail.gmail.com> <4A2EB864.1060006@FreeBSD.org> <20090609221656.752e9c8f@gumby.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for all the replies. It just gets annoying doing the whole /etc/rc.d or /usr/local/etc/rc.d dance. I was loathe to create my own script because it seemed such details as where the rc.d / init.d / etc. directories were located should be abstracted to the operating system, and thus, the operating system's package distribution system or default binaries. Ie. I didn't feel like making an 'rc' script for each type of operating system I admin. On Tue, Jun 9, 2009 at 5:16 PM, RW<rwmaillists@googlemail.com> wrote: > On Tue, 09 Jun 2009 12:30:44 -0700 > Doug Barton <dougb@FreeBSD.org> wrote: > >> Kevin Downey wrote: >> > I have a similar shell function I am rather fond of: >> > >> > rc(){ >> > =A0 =A0 find /etc/rc.d/"$1" /usr/local/etc/rc.d/"$1" -exec sudo {} `ec= ho >> > "$*"|cut -f 2- -d \ ` \; >> > } >> >> Wow, that's painful. :) The only reason you don't notice how painful >> is because those two directories have only a few files. Much much more >> efficient would be something like: >> >> rc () { >> =A0 =A0 =A0 local script=3D$1 >> =A0 =A0 =A0 shift >> >> =A0 =A0 =A0 if [ -x "/etc/rc.d/$script" ]; then >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /etc/rc.d/$script $* >> =A0 =A0 =A0 elif [ -x "/usr/local/etc/rc.d/$script" ]; then >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /usr/local/etc/rc.d/$script $* >> =A0 =A0 =A0 else >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 echo "$script does not exist in /etc/rc.d or= " >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 echo "/usr/local/etc/rc.d" >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1 >> =A0 =A0 =A0 fi >> } > > This kind of thing is already implemented by the > sysutils/bsdadminscripts port. > > _______________________________________________ > freebsd-ports@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17ca67550906091502x93b6d2csdb39019e00f21c73>