Date: Tue, 9 Jun 2009 11:26:44 -0700 From: Freddie Cash <fjwcash@gmail.com> To: freebsd-ports@freebsd.org Subject: Re: Port of "service" command Message-ID: <b269bc570906091126v25c7d9b8q11d689a0b4e14e36@mail.gmail.com> In-Reply-To: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com> References: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 9, 2009 at 10:46 AM, Edwin Shao <eshao@ring0.org> wrote: > I was wondering if there was a port of the Linux/UNIX service > <http://www.manpagez.com/man/8/service/>, > <http://linux.die.net/man/8/service> command? If not, is there any > philosophical reason or roadblock to my creating one? > What's there to port? A simple shell script like the following will work: #!/bin/sh if [ -z "$2" ]; then echo "Missing action." echo "Usage: $( basename ${0} ) {service} {start|stop|restart|reload|status}" exit 2 elif [ -z "$1" ]; then echo "Missing service name." echo "Usage: $( basename ${0} ) {service} {start|stop|restart|reload|status}" exit 1 fi if [ -x /usr/local/etc/rc.d/${1}.sh ]; then runcmd="/usr/local/etc/rc.d/${1}.sh ${2}" elif [ -x /usr/local/etc/rc.d/${1} ]; then runcmd="/usr/local/etc/rc.d/${1} ${2}" elif [ -x /etc/rc.d/${1}.sh ]; then runcmd="/etc/rc.d/${1}.sh ${2}" elif [ -x /etc/rc.d/${1} ]; then runcmd="/etc/rc.d/${1} ${2}" else runcmd="" fi if [ -n "${runcmd}" ]; then echo "Running command: ${runcmd}" ${runcmd} retval=$? else echo "No rc.d script found for ${1}" retval=3 fi exit ${retval} I'm pretty sure something like this was discussed on one of the mailing lists in the past year, as well. You may want to search the archives for ports@, hackers@, and stable@. -- Freddie Cash fjwcash@gmail.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b269bc570906091126v25c7d9b8q11d689a0b4e14e36>