Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
backup script
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: backup script

  1. #1

    backup script

    please can someone out there help a linux noob with a backup/restore script, i require this for college assesment and i do not know how to do it. i have been searching the net, got books but still not any further forward. i need a back/restore script that will backup and restore the file to their own directories. i make a backup folder, with in that i make a wp, ss,pf directories and files within those directories. i am making the backup directory in root (is this right) and using college vm to test, so i am hoping someone out there can come to my rescue.

  2. #2
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    Ehm, first off welcome to the board berto. Second, if you are asking for help its best to start with what you have tried first. Pleas for help with out any effort on the requesters part usually meet with little response other than the type I am providing right now.

    Back up and restore scripts can be as simple as an rsync, or as complicated as an incremental back up by modification date. If you are looking for something a comprehensive, yet surprizingly easly to use check out SBackup it can do, full, incremental, and sequential backups. Originally written for Ubuntu for the Google summer of code. Its written in python, so if you aren't familiar with Perl/Python/Ruby then it probably won't make a lot of sense to look at the source code.
    jro -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

    Linux counter#:213782
    GnuPG ID: 406238E7

  3. #3
    Administrator Advisor peter's Avatar
    Join Date
    Apr 2004
    Posts
    882
    Try using the tar command it can do both backup and restoration and you can include it in a bash script that uses argv to determine whether it should backup or restore.

    My sites:
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

  4. #4
    not from programming background doing networking so source code goes over my head but have to show it as part of my report. used this script from
    intuitive.com/wicked/showscript.cgi?056-backup.sh
    (sorry wont let me post link) and that came back with errors, tried running other posters scripts and came back with different errors to the ones that they were posting so i really do not know what to do.

  5. #5
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    Well first off to troubleshoot anything, the respective error message are greatly helpful. I have the Wicked Cool Shell Scripts book you are linking to there, they have a lot of really great scripts.

    Post the error you are getting, we can start from there. Copy and paste from the terminal to your post, surround with [ CODE ] forums tags
    jro -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

    Linux counter#:213782
    GnuPG ID: 406238E7

  6. #6
    this code that i used
    Code:
    #!/bin/sh
     
    # Backup - create either a full or incremental backup of a set of
    #     defined directories on the system. By default, the output 
    #     file is saved in /tmp with a timestamped filename, compressed.
    #     Otherwise, specify an output device (another disk, a removable).
     
    usageQuit()
    {
      cat << "EOF" >&2
    Usage: $0 [-o output] [-i|-f] [-n]
      -o lets you specify an alternative backup file/device
      -i is an incremental or -f is a full backup, and -n prevents
      updating the timestamp if an incremental backup is done.
    EOF
      exit 1
    }
     
    compress="bzip2"    # change for your favorite compression app
    inclist="/tmp/backup.inclist.$(date +%d%m%y)"
     output="/tmp/backup.$(date +%d%m%y).bz2"
     tsfile="$HOME/.backup.timestamp"
      btype="incremental"    # default to an incremental backup
      noinc=0            #   and an update of the timestamp
     
    trap "/bin/rm -f $inclist" EXIT
     
    while getopts "o:ifn" opt; do
      case "$arg" in
        o ) output="$OPTARG";      ;;
        i ) btype="incremental";    ;;
        f ) btype="full";        ;;
        n ) noinc=1;        ;;
        ? ) usageQuit        ;;
      esac
    done
     
    shift $(( $OPTIND - 1 ))
     
    echo "Doing $btype backup, saving output to $output"
     
    timestamp="$(date +'%m%d%I%M')"
     
    if [ "$btype" = "incremental" ] ; then 
      if [ ! -f $tsfile ] ; then
        echo "Error: can't do an incremental backup: no timestamp file" >&2
        exit 1
      fi
      find $HOME -depth -type f -newer $tsfile -user ${USER:-LOGNAME} | \
        pax -w -x tar | $compress > $output
      failure="$?"
    else
      find $HOME -depth -type f -user ${USER:-LOGNAME} | \
        pax -w -x tar | $compress > $output
      failure="$?"
    fi
     
    if [ "$noinc" = "0" -a "$failure" = "0" ] ; then
      touch -t $timestamp $tsfile
    fi
     
    exit 0
    and this is the errors that i get
    Doing incremental backup, saving output to /tmp/backup.191209.bz21
    Error: can't do an incremental backup: no timestamp file
    so dont know what i am doing wrong ot i have to change part of code any help much appreciated

  7. #7
    this code that i used
    Code:
    #!/bin/sh
     
    # Backup - create either a full or incremental backup of a set of
    #     defined directories on the system. By default, the output 
    #     file is saved in /tmp with a timestamped filename, compressed.
    #     Otherwise, specify an output device (another disk, a removable).
     
    usageQuit()
    {
      cat << "EOF" >&2
    Usage: $0 [-o output] [-i|-f] [-n]
      -o lets you specify an alternative backup file/device
      -i is an incremental or -f is a full backup, and -n prevents
      updating the timestamp if an incremental backup is done.
    EOF
      exit 1
    }
     
    compress="bzip2"    # change for your favorite compression app
    inclist="/tmp/backup.inclist.$(date +%d%m%y)"
     output="/tmp/backup.$(date +%d%m%y).bz2"
     tsfile="$HOME/.backup.timestamp"
      btype="incremental"    # default to an incremental backup
      noinc=0            #   and an update of the timestamp
     
    trap "/bin/rm -f $inclist" EXIT
     
    while getopts "o:ifn" opt; do
      case "$arg" in
        o ) output="$OPTARG";      ;;
        i ) btype="incremental";    ;;
        f ) btype="full";        ;;
        n ) noinc=1;        ;;
        ? ) usageQuit        ;;
      esac
    done
     
    shift $(( $OPTIND - 1 ))
     
    echo "Doing $btype backup, saving output to $output"
     
    timestamp="$(date +'%m%d%I%M')"
     
    if [ "$btype" = "incremental" ] ; then 
      if [ ! -f $tsfile ] ; then
        echo "Error: can't do an incremental backup: no timestamp file" >&2
        exit 1
      fi
      find $HOME -depth -type f -newer $tsfile -user ${USER:-LOGNAME} | \
        pax -w -x tar | $compress > $output
      failure="$?"
    else
      find $HOME -depth -type f -user ${USER:-LOGNAME} | \
        pax -w -x tar | $compress > $output
      failure="$?"
    fi
     
    if [ "$noinc" = "0" -a "$failure" = "0" ] ; then
      touch -t $timestamp $tsfile
    fi
     
    exit 0
    and this is the errors that i get
    Doing incremental backup, saving output to /tmp/backup.191209.bz21
    Error: can't do an incremental backup: no timestamp file
    so dont know what i am doing wrong or do i have to change part of code any help much appreciated

  8. #8
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    The default method of backup for this script is incremental. First, you can't do an incremental backup unless you have first done a full back up. Second, you are going to need the program 'pax' before this script will back anything up, make sure you install it. Third, this script is only going to back up the contents of your home directory, it isn't set up for user-specified backups. Fourth, unless you specify the -o option its just going to save the backup to the /tmp directory.

    Try running this script like so:

    Code:
    sh script.sh -f
    jro -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

    Linux counter#:213782
    GnuPG ID: 406238E7

  9. #9
    cannot use any software and logging via college vm have to show code for the report part of assessment, but thanks for advice have an old laptop and will install a linux distro on it and play about with it once fininshed with this semester

  10. #10
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    If you don't have to actually show the program working, that script should get you where you are going.
    jro -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

    Linux counter#:213782
    GnuPG ID: 406238E7

Similar Threads

  1. Automatic MySQL Backup Script
    By peter in forum Tutorials
    Replies: 1
    Last Post: 09-22-2009, 09:13 AM
  2. Automatic MySQL Backup Script
    By canela in forum Programming
    Replies: 2
    Last Post: 12-20-2006, 04:59 AM
  3. MySQl backup script
    By girlygeek in forum Programming
    Replies: 5
    Last Post: 11-11-2006, 11:23 PM
  4. Redhead, finally finished backup script
    By vwgtiturbo in forum Programming
    Replies: 0
    Last Post: 06-28-2006, 02:42 PM
  5. Rsync incremental backup script
    By vwgtiturbo in forum Programming
    Replies: 6
    Last Post: 06-07-2006, 08:19 PM

Bookmarks

Posting Permissions

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