Find the answer to your Linux question:
Results 1 to 2 of 2
I need help with rewritting a script that I had written a few years ago that has been changed a few times so that it does exactly what I want ...
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    2

    Tar and FTP script

    I need help with rewritting a script that I had written a few years ago that has been changed a few times so that it does exactly what I want it to do.

    Basically I need it to tar up MySQL tables, and to tar up a copy of a website from its DocumentRoot and then for it to FTP it to another server so it can be backed up on our backup server.

    What I have so far is:

    #!/bin/sh
    #
    # file: backup.sh
    # date: 22/05/2006
    #

    # variables
    HOSTNAME=`uname`
    WEEKDAY=`date '+%a'`
    BACKUPFILE=/usr/backup/$HOSTNAME-sqlbackup-webserver.tar.gz
    DATABASES="alfresco dummy ezpublish filton gas mysql therese"
    WEBSITEBACKUP="/usr/backup/$HOSTNAME-webbackup-webserver.tar.gz"
    # BACKUPSERV="/backup/tech_1/backup"

    # MySQL Backup Hourly
    for i in $DATABASES
    do
    mysqldump --user root --password=MVTMJSUNP --add-drop-table $i \
    > /usr/backup/sqlbackup/$i-$WEEKDAY.sql
    done

    # at midnight copy the backup
    #if [ `date '+%H'` == "02" ]; then
    # tar up sql backups
    /bin/tar --gzip \
    --create \
    --file=$BACKUPFILE \
    --exclude=$BACKUPFILE \
    --absolute-names \
    /usr/backup/sqlbackup/

    # copy the backup to the backup server
    # check that its mounted
    # if [ -d $BACKUPSERV ]; then
    # /bin/cp -f $BACKUPFILE $BACKUPSERV
    # else echo "Volume not mounted" && exit 1
    # fi
    #fi

    This script used to backup to a netware server, but we dont use that anymore its all Active Directory based now. and I know the MySQL part of it works I just need it to tar up the website files as well (just dont know how to add another tar into the script) its my own fault for only really knowing how to use Windows.. lol

    Hopefully this makes sense to someone.

    Thanks in advance
    Derrick

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    2
    Why is it that I always feel like no one is listening to me when I ask for help?.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...