Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Linux VPS Support

Notices

Reply
 
Thread Tools
  #1  
Old 01-23-2011, 05:18 PM
doulos doulos is offline
Junior Croc
 
Join Date: Feb 2007
Posts: 145
Default Crontab problem

I have been running a particular cronjob on a reseller account for years, but when I use the same job on a new VPS account nothing is dumped and I get this error emailed to me:

Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help


If I copy and paste the job exactly to terminal it runs fine and a backup is created.

Here is the job:

date=`date -I` ; mysqldump -uUSERNAME -pPASSWORD DATABASENAME > /home/USERNAME/sqlbackups/DATABASE_$date.sql; gzip /home/USENAME/sqlbackups/DATABASENAME_$date.sql

Any suggestions?
Reply With Quote
  #2  
Old 01-23-2011, 06:03 PM
quietFinn's Avatar
quietFinn quietFinn is offline
Veteran Croc
 
Join Date: Feb 2005
Posts: 3,557
Default Re: Crontab problem

I believe it should be:
-u USERNAME
not:
-uUSERNAME
__________________
quietFinn - netFinn Finland
"Be who you are and say what you feel because those who mind don't matter and those who matter don't mind." - Dr. Seuss
Reply With Quote
  #3  
Old 01-23-2011, 07:07 PM
doulos doulos is offline
Junior Croc
 
Join Date: Feb 2007
Posts: 145
Default Re: Crontab problem

date=`date -I` ; mysqldump -u USERNAME -pPASSWORD DATABASENAME > /home/USERNAME/sqlbackups/DATABASE_$date.sql; gzip /home/USENAME/sqlbackups/DATABASENAME_$date.sql

same error, but runs fine manually

Last edited by doulos; 01-23-2011 at 07:16 PM.
Reply With Quote
  #4  
Old 01-23-2011, 08:53 PM
doulos doulos is offline
Junior Croc
 
Join Date: Feb 2007
Posts: 145
Default Re: Crontab problem

Even though I changed nothing... it started working. We'll see if it continues.

Thanks for your time.
Reply With Quote
  #5  
Old 01-27-2011, 01:50 AM
doulos doulos is offline
Junior Croc
 
Join Date: Feb 2007
Posts: 145
Default Re: Crontab problem

Ok, another problem. I am trying to run a backup of my public_html folder, but exclude all files in folder A, and then put the backup in folder B. As far as I can tell this cronjob does the backup but is not excluding the files and puts the backup in the root directory - and an empty file in directory B.

Can someone who knows what's what tell me how to fix this?

date=`date -I` ; tar -zcf backup_$date.tgz ./public_html --exclude=/home/USERNAME/public_html/folder A > /home/USERNAME/folder B/backup_$date.tgz
Reply With Quote
  #6  
Old 01-28-2011, 12:54 PM
doulos doulos is offline
Junior Croc
 
Join Date: Feb 2007
Posts: 145
Default Re: Crontab problem

I tried this but still doesn't exclude...

date=`date -I` ; tar -zcf backup_$date.tgz ./public_html --exclude= "/home/USERNAME/public_html/folder A"

Also tried this - it didn't exclude:

date=`date -I` ; tar -zcf backup_$date.tgz --exclude= "/home/USERNAME/public_html/folder A" ./public_html
Reply With Quote
  #7  
Old 01-28-2011, 01:26 PM
mp3 mp3 is offline
Junior Croc
 
Join Date: Dec 2007
Posts: 167
Default Re: Crontab problem

Quote:
Originally Posted by doulos View Post
date=`date -I` ; mysqldump -u USERNAME -pPASSWORD DATABASENAME > /home/USERNAME/sqlbackups/DATABASE_$date.sql; gzip /home/USENAME/sqlbackups/DATABASENAME_$date.sql

same error, but runs fine manually
This is a pretty good indication (usually) that you are relying on an environmental variable somewhere.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run php Script With CronTab hiphil Shared Hosting Support 3 10-18-2008 12:17 PM
Db problem any help jasonec Shared Hosting Support 3 02-04-2007 09:30 PM

All times are GMT -5. The time now is 07:59 PM.