Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-12-2004, 12:15 PM   #1
Registered: Oct 2003
Location: MN
Distribution: CentOS, Fedora
Posts: 182

Rep: Reputation: 30
Setting up automatic jobs

Hey all,

I'm wondering what the best method is under Linux (Fedora Core 1) to set up some set jobs to run every day. Here's what I want the job to do:

1. Stop the MySQL service.
2. Compress the /var/lib/mysql folder into a single RAR file.
3. Start the MySQL service as soon as the archive is created.
4. Move the archive to a network folder.

Each of these are easy on their own. I want to have a single job that does each of these in turn. I'm aware of Cron, but I'm not sure how to get it to run something like this. As far as I know, I would have to specify the time of day I want each job part to run. I don't know how long the creating of the archive will take, and it will vary depending on how big the databases are. I can't very well have the service trying to start and modify the tables while they are being compressed.

So, I'm hoping someone can suggest a method to run each of the steps above in order, as soon as the previous step completes so I don't have to specify a time for each.

Old 05-12-2004, 12:47 PM   #2
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
I would create a script that does what you need then just put the script into cron.

Just guessing but your script would be something like this:

/etc/init.d/mysql stop
tar -zcf /tmp/database_backup.tgz /var/lib/mysql #not sure what rar command would be.
sleep 2 #just to be sure it completes
/etc/init.d/mysql start

Then you would need to setup cron:
crontab -e
put a line in like this:
* 1 * * * /root/
Old 05-12-2004, 12:49 PM   #3
Registered: May 2004
Distribution: Fedora Core 2
Posts: 50

Rep: Reputation: 15
This might not be a direct answer but you can start by going to linux tutorial .info
here is the link to the cron section.....
Hope this helped a bit...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Jobs ! meandrain Linux - General 5 08-04-2005 07:32 PM
Jobs at Linspire RySk8er30 Linspire/Freespire 40 08-03-2005 06:57 PM
Setting up Canon i550 on lp0 under CUPS; print jobs disappear kaiwen Linux - General 3 12-09-2004 02:25 AM
fg, jobs etc ftgow Linux - General 7 02-26-2004 11:28 PM
background jobs seize630 Linux - General 6 10-14-2003 04:16 PM > Forums > Linux Forums > Linux - Newbie

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

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