Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Aug 2008 09:57:07 +0100
From:      Vincent Hoffman <vince@unsane.co.uk>
To:        Alex Kozlov <spam@rm-rf.kiev.ua>
Cc:        hackers@freebsd.org, Mike Meyer <mwm@mired.org>
Subject:   Re: Idea for FreeBSD
Message-ID:  <489C0A63.8040600@unsane.co.uk>
In-Reply-To: <20080808033317.GA96397@ravenloft.kiev.ua>
References:  <20080808033317.GA96397@ravenloft.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Alex Kozlov wrote:
> On Thu, Aug 07, 2008 at 11:25:39AM -0400, Mike Meyer wrote:
>   
>> On Thu, 7 Aug 2008 09:15:00 +0300 Alex Kozlov <spam@rm-rf.kiev.ua> wrote:
>>     
>>> [1]:
>>> $cat /usr/local/bin/service
>>>       
>> Basically what I had in mind, but it can be made more portable across
>> FreeBSD configurations.
>>
>>     
> [...]
>   
>> And here's where you go wrong. What you want now is:
>>     
> Yes. This is more correct:
>
>   
Just to save reimplementing the wheel, have a look also at the 
sysutils/bsdadminscripts port. it has rcstart (and various hardlinks,) 
which are intended for pretty much what youre intending I think.


Vince
> #!/bin/sh
>
> name=$1
> cmd=$2
>
> if [ -z "${name}" -o -z "${cmd}" ]; then
>     echo ${0##*/} service_name command
>     exit 3
> fi
>
> . /etc/rc.subr
>
> load_rc_config ${name}
>
> for dir in /etc/rc.d ${local_startup}; do
>     if [ -r "${dir}/${name}" ]; then
>         run_rc_script "${dir}/${name}" ${cmd}
>         exit 0
>     fi
>
>     if [ -r "${dir}/${name}.sh" ]; then
>         run_rc_script "${dir}/${name}.sh" ${cmd}
>         exit 0
>     fi
> done
>
> echo "service '${name}' not found"
> exit 2
>
>
> --
> Adios
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>   




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?489C0A63.8040600>