Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-19-2011, 08:47 AM
|
#1
|
Member
Registered: Aug 2007
Posts: 346
Rep:
|
crontab fails but command line works -
Having an odd problem running a mysqldump via crontab. I have the script running on other servers and they work fine, so not sure how to actually troubleshoot, but the script looks like the following;
rm -rf /archives/server_baks/*
if mysqldump -u root --password=pwhere --databases tables_here --add-locks | gzip > /archives/server_baks/mysql.$(date +%Y-%m-%d_%H%P).sql.gz
echo "ERROR: The backup failed."
fi
If I run it as a cronjob as root, it finishes in a second and a 20k file is there. If I run it from the command line as root it does the backup (takes a few minutes) but does complete the backup and can be unzipped and read successfully.
Any ideas why / how?
|
|
|
02-19-2011, 09:12 AM
|
#2
|
Member
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731
Rep:
|
Hi,
First you should use absolut paths to the executable programs, because does not know about PATH set in your session. Try again and check if your problem occurs after this change.
|
|
1 members found this post helpful.
|
02-19-2011, 05:18 PM
|
#3
|
Member
Registered: Aug 2007
Posts: 346
Original Poster
Rep:
|
[solved]
As much as I would love to say it can't be;
which mysqldump reveals only the one;
/usr/local/mysql/bin/mysqldump
and that is in the local path as I can type mysqld <tab> with the autocomplete, but I did update the script to the full path and it worked, so I am still curious, but won't dispute!
Thanks for the basic idea!
|
|
|
02-19-2011, 05:43 PM
|
#4
|
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625
Rep:
|
which finds executables in the PATH environment variable. cron usually runs under a smaller PATH than a login shell.
|
|
|
All times are GMT -5. The time now is 08:28 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|