[ic] call the create catalog tar.gz from command line

Duane Hinkley duane at dhwd.com
Wed Dec 22 12:08:10 EST 2004


Tom wrote:

>Hi,
>
>I would like to schedule a create catalog tar backup job from cron or possibly interchange via a job.
>
>Is there a command to do this, I looked in the interchange/bin directory, but could not see what to use.
>
>Also I could not find any documentation on interchange jobs, is this something that should be left to cron?
>
>Cheers,
>
>Tom 
>_______________________________________________
>interchange-users mailing list
>interchange-users at icdevgroup.org
>http://www.icdevgroup.org/mailman/listinfo/interchange-users
>
>  
>
Here's a script I use to mirror catalog from one server to another.  It 
could be modified to just create a backup.

=====================================================
#!/bin/bash

# $Id: download_catalog,v 1.1 2004/11/03 22:43:25 cvs Exp $
#
# Downloads an Interchange catalog from the online version
#
DBNAME=$1
USERNAME=$2
STORENAME=$3

if [[ "X$DBNAME" != "X" && "X$USERNAME" != "X" && "X$STORENAME" != "X" 
]];then

   ssh yourhostname "mysqldump -u root -ppassword --add-drop-table 
$DBNAME" | mysql -u root -ppassword $DBNAME

   ssh yourhostname "tar -C /home/$USERNAME --exclude 
catalogs/$STORNAME/session \
                                        --exclude 
catalogs/$STORNAME/error.log \
                                        --exclude catalogs/$STORNAME/tmp  \
                                        --exclude catalogs/$STORNAME/logs  \
                                        --exclude 
catalogs/$STORNAME/backup \
                                        --exclude 
catalogs/$STORNAME/orders -czf - catalogs/$STORNAME 
www/htdocs/$STORNAME" | tar -C /home/$USERNAME -xzf -

else

  echo "Usage: download_catalog dbname username storename"

fi

====================================================
This part of that script alone may do what you want:

tar -C /home/$USERNAME --exclude catalogs/$STORNAME/session \
                                        --exclude 
catalogs/$STORNAME/error.log \
                                        --exclude catalogs/$STORNAME/tmp  \
                                        --exclude catalogs/$STORNAME/logs  \
                                        --exclude 
catalogs/$STORNAME/backup \
                                        --exclude 
catalogs/$STORNAME/orders -czf catalog.tar.gz \
                                     catalogs/$STORNAME www/htdocs/$STORNAME

The script assumes the store is in /home in the structure /home/username/catalogs/storename and the web files are in /home/username/www/htdocs/storename

-- 

Sincerely,

Duane Hinkley
Down Home Web Design, Inc.
(208) 424-0572 Fax(208) 587-0738

duane at downhomewebdesign.com
www.downhomewebdesign.com



More information about the interchange-users mailing list