[lug] Scripting something that relies on pwd

Nate Duehr nate at natetech.com
Mon Feb 19 22:20:46 MST 2001


On Mon, Feb 19, 2001 at 09:46:33PM -0700, Tkil wrote:
> >>>>> "John" == John Starkey <jstarkey at advancecreations.com> writes:
> 
> John> I need to start mysql on boot and it's only allowing me to do so
> John> from it's parent dir. I've tried adding to rc.local (when it was
> John> running at boot) and adding a script in the mysql parent
> John> dir. But that didn't work. Do i need to chroot when i do this?
> John> If so , how do i get back out for the rest of the boot? If not.
> John> Anyone know how i can do this?
> 
> typically, you start a sub-process with a different working directory
> by using a subshell, invoked with parentheses:
> 
>    $ ( cd /path/to/wherever; ./bin/run_me & )
> 
> (maybe put the ampersand outside the parens?)  this should work in
> rc.local as well.
> 
> in the case of mysql in particular, it ships with a script that can be
> used with the sysv-init style /etc/rc.d/* directories, and i've never
> had a problem with cwd using that script.

Good call.  Forgot about that.

-- 
Nate Duehr <nate at natetech.com>

GPG Key fingerprint = DCAF 2B9D CC9B 96FA 7A6D AAF4 2D61 77C5 7ECE C1D2
Public Key available upon request, or at wwwkeys.pgp.net and others.



More information about the LUG mailing list