Help - Search - Members - Calendar
Full Version: Cron scripts.
The Planet Forums > System Administration > General Support Questions
Coastie
I currently have a few scripts that I run via cron for nightly backups. I'd like to combine them for better time management on my part, and to make it easier to add new routines.

I currently backup 4 SQL databases with 4 different scripts and at 4 different times all called via cron.

If I were to put all the commands into one single script, would they all play nice and run one after the other and only continue once the previous backup completes, or would they all try to run at once bringing the server to it's knees?

Here is an example of what I would like my single file to look like:
CODE
mysqldump -u USER -pPASS --opt DATABASE1| gzip > /SAVE/PATH1/SQL.$(date +%a).gz

mysqldump -u USER -pPASS --opt DATABASE2| gzip > /SAVE/PATH2/SQL.$(date +%a).gz

mysqldump -u USER -pPASS --opt DATABASE3| gzip > /SAVE/PATH3/SQL.$(date +%a).gz

mysqldump -u USER -pPASS --opt DATABASE4| gzip > /SAVE/PATH4/SQL.$(date +%a).gz


Would they execute in order one after the other completes?
iiw
If you put them in a single shell script and cron that script they will execute in order by the nature of a shell script.

All you need to do is create a file with #!/bin/sh on the top and then paste your lines in, then chmod 755 your script and place an entry for that script in your crontab file.
Coastie
great thank you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.