LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-23-2006, 08:39 AM   #1
muskiediver
LQ Newbie
 
Registered: Mar 2006
Posts: 24

Rep: Reputation: 15
I am trying to learn cron jobs. I am trying to ad the following in plesk:


I want this cron job to run everyday at 5:30pm

mysqldump -h mydomainip -u myusername -mypassword --add-drop-table -n --databases mydatabasefile > /var/www/vhosts/mydomain/database060721_1324.sql

The name of the file is stamped with the date and time (if there is an easier way of doing this, then please utilize it). Each file will have it's own unique name. The name will be based on the date and time. Currently my file contains the last two digits of the current year(see above) - 06 the year, the month 07, and the date - 21. There is an underscore then the time 1324 military time (or 1:34pm).

Can anyone please assist?
 
Old 11-23-2006, 08:47 AM   #2
zefo
Member
 
Registered: Mar 2003
Posts: 71

Rep: Reputation: 15
this could work although i have not tested it

30 17 * * * mysqldump -h mydomainip -u myusername -mypassword --add-drop-table -n --databases mydatabasefile >"/var/www/vhosts/mydomain/database$(date +%g%m%d_%H%M).sql"

note: try to give your questions a meaningful subjects next time

-- joe
 
Old 11-23-2006, 08:58 AM   #3
muskiediver
LQ Newbie
 
Registered: Mar 2006
Posts: 24

Original Poster
Rep: Reputation: 15
Thank you.

Do I leave in the quotes?

Last edited by muskiediver; 11-23-2006 at 09:00 AM.
 
Old 11-23-2006, 11:27 AM   #4
zefo
Member
 
Registered: Mar 2003
Posts: 71

Rep: Reputation: 15
yes, should work as it is.
 
Old 11-23-2006, 12:49 PM   #5
muskiediver
LQ Newbie
 
Registered: Mar 2006
Posts: 24

Original Poster
Rep: Reputation: 15
Does not appear to work.

I am under my username in Plesk

Under Crontab

Under Task (I believe this will run every 15 minutes between 9am and 5 pm)

Minute */15
Hour 9-17
Day of the Month *
Month *
Command: mysqldump -h mydomainip -u myusername -mypassword --add-drop-table -n --databases mydatabasefile >"/var/www/vhosts/mydomain/Mydat$(date +%g%m%d_%H%M).sql"

Note: Mydat is the name I replaced database with. I assumed it does not need database in the file name.

Last edited by muskiediver; 11-23-2006 at 01:09 PM.
 
Old 11-24-2006, 01:42 AM   #6
zefo
Member
 
Registered: Mar 2003
Posts: 71

Rep: Reputation: 15
be sure crond is running (i recommend restarting cron service). you could also put the commandline into a script and then calling it from cron like this: /path/to/script/script >/home/plesk/script.out 2>/home/plesk/script.err. this way you can check if the script went fine. grepping syslog may be also helpful.

cheers,

-- joe
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me... Linux Server.. With Plesk.. Cron Tab 00tbone00 Linux - General 1 07-15-2006 01:16 AM
Cron Jobs christo512 Linux - Software 1 02-09-2006 09:19 AM
Cron Jobs XaViaR Linux - General 1 06-23-2005 06:57 PM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration