On Wed, 06 Feb 2008 17:09:50 +0000
Alex Zbyslaw <[EMAIL PROTECTED]> wrote:

> I personally much prefer scripts in rc.d because it's much easier to 
> migrate than crontabs, and if I never use a crontab I always know
> where to look.
> 
> It looks to me like you shouldn't be starting the demon as user api - 
> startups scripts should always be started as root.  If the demon or 
> whatever is supposed to run as api not root, then perhaps your script 
> should say e.g.
> 
>     su api -c the-path-to-the-demon-or-whatever
> 
> root can su to whoever without a password, and api can su to api
> without a password, and everyone else gets prompted.

It's actually built into /etc/rc.subr,  the subversion server script is
a simple example of starting a daemon with a different user:

$ grep -v "^#" /usr/local/etc/rc.d/svnserve


. "/etc/rc.subr"

svnserve_enable=${svnserve_enable:-"NO"}
svnserve_flags=${svnserve_flags:-"-d --listen-port=3690"}
svnserve_data=${svnserve_data:-"/usr/local/repositories"}
svnserve_user=${svnserve_user:-"svn"}
svnserve_group=${svnserve_group:-"svn"}

name=svnserve
rcvar=`set_rcvar`
load_rc_config $name
command=/usr/local/bin/svnserve
command_args="-r ${svnserve_data}"

run_rc_command "$1"
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to