From owner-freebsd-ports@FreeBSD.ORG Sun Apr 29 10:25:45 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FF2C16A408 for ; Sun, 29 Apr 2007 10:25:45 +0000 (UTC) (envelope-from tobias.brink@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.freebsd.org (Postfix) with ESMTP id 95B6813C45A for ; Sun, 29 Apr 2007 10:25:44 +0000 (UTC) (envelope-from tobias.brink@gmail.com) Received: by ug-out-1314.google.com with SMTP id 71so915784ugh for ; Sun, 29 Apr 2007 03:25:43 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:date:message-id:from:to:cc:subject:user-agent:mime-version:content-type; b=Tw+0nKY+G/Vbj1w1nHgXdu3PfBQ8Em37F0b5kFznN70o29tq1JhEr8h0xy2oaSgedORQIZY8T+OwqD6RCXEEZQnFlo9hzbCdJDI7bLVX3C0XLBOg/4CGaqK2HavRne8gUxIA4pWz37gbcUu2mjuzSfH/tB/guwq/igtyyIbQTWQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:message-id:from:to:cc:subject:user-agent:mime-version:content-type; b=lgmXFV2pZPUH44UBQx/4YYJDg4pGfAOAgJKvMJGOf5TX/DomKTT3/nefbf9w+1jagS0n+V0xXH3Xpy7/4U/r4txvM/fMOmekmxoKVgD/Ch2XqQCMIHjGGgF7KDFY86NrCTiSQ/dKT6lemmyK7lZEaDhyCrrerHd9KCpUCuOnCK4= Received: by 10.66.243.4 with SMTP id q4mr4469438ugh.1177840613654; Sun, 29 Apr 2007 02:56:53 -0700 (PDT) Received: from spark.homenetwork ( [84.167.114.26]) by mx.google.com with ESMTP id j34sm8014334ugc.2007.04.29.02.56.52; Sun, 29 Apr 2007 02:56:52 -0700 (PDT) Date: Sun, 29 Apr 2007 11:56:39 +0200 Message-ID: <87k5vvh5bc.wl%tobias.brink@gmail.com> From: Tobias Brink To: onatan@gmail.com User-Agent: Wanderlust/2.14.1 (Bad Medicine-pre) Emacs/22.0 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sun_Apr_29_11:56:39_2007-1" Cc: ports@FreeBSD.org Subject: FreeBSD Port: linux-foldingathome-5.02, rc.d script 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: Sun, 29 Apr 2007 10:25:45 -0000 --Multipart_Sun_Apr_29_11:56:39_2007-1 Content-Type: text/plain; charset=US-ASCII Hello. I use the folding@home client on a machine which runs mostly unattended so it would be a hassle to start it manually after each boot. Therefor I went ahead and created a rc.d script for it. It is attached to this mail. I thought it could be useful enough to be included in the port. You can set a user under which the program will run and a directory where it will be run and store its files. These are currently set to user: root and working dir: /usr/local/share/foldingathome which is like running /usr/local/bin/FoldingAtHome as root. Feel free to contact me for any questions/corrections, I'd be happy to hear any constructive criticism because this is my first rc.d script. Feel also free to use this script in any way you see fit. Regards, Tobias --Multipart_Sun_Apr_29_11:56:39_2007-1 Content-Type: text/plain; charset=US-ASCII Content-Disposition: attachment; filename="fah" Content-Transfer-Encoding: 7bit #!/bin/sh # PROVIDE: fah # REQUIRE: networking . /etc/rc.subr name="fah" rcvar=`set_rcvar` command="/usr/local/share/foldingathome/FAH502-Linux.exe" #procname="" command_args="> /dev/null 2>&1 &" fah_flags="-freeBSD $fah_flags" start_precmd="${name}_prestart" start_postcmd="${name}_poststart" start_cmd="${name}_start" load_rc_config $name eval "${rcvar}=\${${rcvar}:-'NO'}" fah_workdir=${fah_workdir:-"/usr/local/share/foldingathome/"} fah_user=${fah_user:-"root"} required_dirs="$fah_workdir" fah_prestart() { fah_CURRDIR=`pwd` cd $fah_workdir } fah_poststart() { cd $fah_CURRDIR } fah_start() { su $fah_user -c "nice -n 20 $command $fah_flags $command_args" } run_rc_command "$1" --Multipart_Sun_Apr_29_11:56:39_2007-1--