From owner-freebsd-questions@FreeBSD.ORG Sat Feb 14 01:01:04 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0133F16A4CE for ; Sat, 14 Feb 2004 01:01:04 -0800 (PST) Received: from geminix.org (gen129.n001.c02.escapebox.net [213.73.91.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id B677343D1D for ; Sat, 14 Feb 2004 01:01:03 -0800 (PST) (envelope-from gemini@geminix.org) Message-ID: <402DE3CC.10603@geminix.org> Date: Sat, 14 Feb 2004 10:01:00 +0100 From: Uwe Doering Organization: Private UNIX Site User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040119 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Questions References: <20040214004739.GD650@keyslapper.org> <20040213200721.F67547@admin1.mdc.net> In-Reply-To: <20040213200721.F67547@admin1.mdc.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Received: from gemini by geminix.org with asmtp (TLSv1:AES256-SHA:256) (Exim 3.36 #1) id 1Arvfa-0000QK-00; Sat, 14 Feb 2004 10:01:02 +0100 Subject: Re: startup daemon as unpriviliged user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2004 09:01:04 -0000 matthew wrote: > On Fri, 13 Feb 2004, Louis LeBlanc wrote: >>[...] >>So, how can I get a process to run automatically on startup for an >>unprivileged user? > > cd /usr/local/etc/rc.d > > make a small sh script like so: > > #!/bin/sh > su username -c "command" For scripts in '/usr/local/etc/rc.d' one should stick to the required semantics. That is, in this particular case you need to make sure that it only runs on startup and not a second time on shutdown. Like so: ------------------------ cut here ------------------------ #!/bin/sh case "$1" in start) su username -c "command" ;; stop) ;; esac ------------------------ cut here ------------------------ Also, keep in mind that the script's name requires a suffix of '.sh', or else the system won't execute it automatically. Uwe -- Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers gemini@geminix.org | http://www.escapebox.net