View Single Post
  #2 (permalink)  
Old 07-10-2009, 10:32 PM
cPanelEricE's Avatar
cPanelEricE cPanelEricE is offline
cPanel Staff (Administrator)
 
Join Date: Nov 2007
Location: Texas
Posts: 170
cPanelEricE is on a distinguished road
Howdy,

It sounds like you're mostly there. You need to stage this right and it'll be a breeze. You've got a lot of the logic thought out so let's get started.

First Let's make a scripts folder to run this all from do that with this command:

cd <enter> (this will get you back to your home folder)
mkdir scripts

in this folder I would put a sample copy of your htaccess-open and htaccess-closed. You don't need to name them .htaccess... so you won't loose them.

Now for the script. I picked bash since a lot of what you have is in bash ready.

Code:
#!/bin/bash
#BackupStore.sh
#purpose to close the store and backup the database
echo "Closing up shop"
cat ~/scripts/htaccess-closed > ~/public_html/.htaccess
echo "Sleeping 10 seconds to let connections die"
sleep 10s
mysqldump --opt (DB_NAME) -u (DB_USERNAME) -p(DB_PASSWORD) > /path/to/dbbackup-$(date +%m%d%Y).sql
sleep 3s
cat ~/scripts/htaccess-open > ~/public_html/.htaccess
Run it in cron as sh scriptname.sh or chmod +x it and ./path/to/scriptname.sh to run it.
__________________
--Eric(E)

Using Enkompass compared to cPanel is like going to a MacDonald’s in France, sure they’ve got the same things we have over here, but it’s a little different.
Reply With Quote