Hello,
Try to locate the mysqldump using the following command.
locate mysqldump
Main Topics
Browse All TopicsGetting the following error in an email from the scheduled task cron system on a dedicated server:
sh: /mysqldump: No such file or directory
The cron runs a php file with code that executes a mysqldump command using exec. The code works fine when accessed via a url and also ok via an SSH terminal (Putty) but not via cron. The command we're using (with password and path removed) is below.
I've tried adding /usr/bin/ infront of mysqldump, but no difference:
Any ideas please? The control panel is Plesk.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>>> Entering locate mysqldump in Putty at root level returns command not found.
That implies your environment variable 'PATH' is not set properly. Check to make sure /usr/bin is included.
>>> Same command in Php file works via url but not via cron.
Make sure the user running the cron job has appropriate access to /usr/bin. That access could be restricted by file system rights or by PHP's operating environment. Running PHP from the command line will create a different environment than running it from a web page. Try a cron job that writes phpinfo() to a local file and examine the configuration.
the locate command is not recognised, however whereis confirms mysqldump location as /usr/bin/
The cron now seems to be finding mysqldump but is now giving the following error:
Permission denied
mysqldump: Got errno 32 on write
So as you infer above there are some permissions issues when running cron. How can I give the cron environment the same permissions as the web url environment, or is that a security issue?
You need to verify which user is running the cron job, and verify that user has write permission to the directory. You say the directory is 777, so any user should be able to write to it. The existing file, though, is read-only for anybody but the owner/group. Instead of making the file 666 (which adds write to 'everyone'), consider adding the cron user to the file's group owner.
The cron will now create new backup files ok with owner name as the account name, but the existing backup files have the owner set as 'apache' (the existing files were created by running the php script via a url). For the moment I've renamed the existing files and hope the new files will now be overwritten correctly on a rolling basis as the ownership will be the account name. Not sure how the existing files came to have an ownership of 'apache'.
>>> Not sure how the existing files came to have an ownership of 'apache'.
That is the user that originally created them. That means either your cron job was running as apache, or the cron job called a script to run under the web service account.
Either way, you could chown those files if it becomes a problem.
Business Accounts
Answer for Membership
by: routinetPosted on 2009-10-22 at 00:10:32ID: 25631464
Have you verified the location of mysqldump?