[lug] Scripting something that relies on pwd

Tkil tkil at scrye.com
Mon Feb 19 21:46:33 MST 2001


>>>>> "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.

t.




More information about the LUG mailing list