Date: Sat, 14 Feb 2004 10:01:00 +0100 From: Uwe Doering <gemini@geminix.org> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: startup daemon as unpriviliged user Message-ID: <402DE3CC.10603@geminix.org> In-Reply-To: <20040213200721.F67547@admin1.mdc.net> References: <20040214004739.GD650@keyslapper.org> <20040213200721.F67547@admin1.mdc.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?402DE3CC.10603>