From owner-freebsd-ports@FreeBSD.ORG Tue Jun 9 18:54:03 2009 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C19FC10656EC for ; Tue, 9 Jun 2009 18:54:03 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.221.173]) by mx1.freebsd.org (Postfix) with ESMTP id 7C5478FC23 for ; Tue, 9 Jun 2009 18:54:03 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: by qyk3 with SMTP id 3so301049qyk.3 for ; Tue, 09 Jun 2009 11:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=AuHPFwUMWFJV+30KYEEcyVzB2LiH0aMS3mQewbLn/KQ=; b=ufSRTk2YoeS1uvSpzp2NYy10MJFQYkkTrSyfSQClJAEt+peNT9TeVHJsv0Wj0voOdY /C47C3nVV5H5OkrK8s9LdFICHD9Pxy3AdUouKHf8TBkD0vmRNaLecIFK2s7Z6FSsPGB+ P1XCxr9aOXSGV0jzCqa52Qnt/l/UQPP8IEsOQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=V1HKoUQMNwICi6c1pApmw1wSZO7GTLyhJ3PEgf/fqZCG3/yajTeQjHgOs8MrRbIPE4 X1Vnjj4MUgmqG8OD5R0v4w1reJ3ZTccALeDqhBIeGO/4zl0eOi/0uIqzXvVa5VZFZckJ C9sFnppRGKY5JmS+lsjcXhVBjxHp+DZN1dMpo= MIME-Version: 1.0 Received: by 10.151.125.11 with SMTP id c11mr908926ybn.138.1244572005238; Tue, 09 Jun 2009 11:26:45 -0700 (PDT) In-Reply-To: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com> References: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com> Date: Tue, 9 Jun 2009 11:26:44 -0700 Message-ID: From: Freddie Cash To: freebsd-ports@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Port of "service" command X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 18:54:04 -0000 On Tue, Jun 9, 2009 at 10:46 AM, Edwin Shao wrote: > I was wondering if there was a port of the Linux/UNIX 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