Re: init script can't find /bin/dirname
On 2014-12-21 21:58 +0100, Rob Owens wrote:
> The /etc/init.d/mysql script on one of my systems is complaning that it
> can't find /bin/dirname and /bin/basename. Line 24 of the script is
> SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
> Both dirname and basename live in /usr/bin, not /bin.
Which should be fine from the script's point of view as long as
$remote_fs is in the "Required-Start" header (i.e. /usr is guaranteed to
> I know I could add a PATH statement to the init script, but this problem
> is my own doing and I'd like to fix it right. I "cross-graded" this
> system from 32-bit to 64-bit using this guide:
> It worked pretty well, but not perfectly. Some things got missed, like
> screen, ntp, and a couple other packages. I'm thinking that maybe
> another missing package is preventing the mysql init script from
> checking for /usr/bin/dirname.
That seems to be unlikely, but you could add a line with "echo $PATH" to
the script to find out what PATH actually is.
> I can run '/etc/init.d/mysql start' from a terminal and it works fine,
> because it picks up the PATH associated with the terminal. So this is
> only a boot-time issue.
> So is there a package or a global setting somewhere that sets the PATH
> for init scripts?
PATH is set directly by init. If I read the source code correctly,
sysvinit sets it to "/sbin:/usr/sbin:/bin:/usr/bin" while systemd uses