Port of "service" command

Edwin Shao poleris at gmail.com
Tue Jun 9 22:26:39 UTC 2009


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 at googlemail.com> wrote:
> On Tue, 09 Jun 2009 12:30:44 -0700
> Doug Barton <dougb at FreeBSD.org> wrote:
>
>> Kevin Downey wrote:
>> > I have a similar shell function I am rather fond of:
>> >
>> > rc(){
>> >     find /etc/rc.d/"$1" /usr/local/etc/rc.d/"$1" -exec sudo {} `echo
>> > "$*"|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 () {
>>       local script=$1
>>       shift
>>
>>       if [ -x "/etc/rc.d/$script" ]; then
>>               /etc/rc.d/$script $*
>>       elif [ -x "/usr/local/etc/rc.d/$script" ]; then
>>               /usr/local/etc/rc.d/$script $*
>>       else
>>               echo "$script does not exist in /etc/rc.d or"
>>               echo "/usr/local/etc/rc.d"
>>               return 1
>>       fi
>> }
>
> This kind of thing is already implemented by the
> sysutils/bsdadminscripts port.
>
> _______________________________________________
> freebsd-ports at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"
>


More information about the freebsd-ports mailing list