Dear freebsd-rc,

I just recently dived into writing my own RC scripts. I have read the
rc.subr(8) manpage as well as the "Practical rc.d scripting in BSD"
document, and I have a few questions as to how things are what the are
and how to attain a certain goal.

My first questions stem from reading the limits(1) manpage. Since limits
can handle both setting environment variables and the user running the
command, why does setting ${name}_env and ${name}_user call respectively
env(1) and su(1) ? Would it not be more elegant to simply use the
corresponding flags in limits(1), since it is called anyway ?

Secondly, I am trying to have the `command` of my rc script called in a
specific directory. This works as expected by setting ${name}_chdir, so
that doit becomes `cd ... && limits -C daemon ${command}...`. However,
if I also set ${name}_user, then the command run by limits becomes
`su -m $user -c 'sh -c $command'`, which completely annihilates the
previous `cd ...`. 

What is the correct way of running a command in a specific directory as
a specific user ? Since settings ${name}_user seems to cancel
${name}_chdir (as well as any manual changes done in ${name}_prepend).

Cheers and happy hacking,

-- 
Joachim Desroches

Attachment: signature.asc
Description: PGP signature

Reply via email to