Find the answer to your Linux question:
Results 1 to 2 of 2
Hello yes i was wondering if anyone knows any good simple bash scripts for backing up my hard drive onto a external hard drive>?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    3

    Simple Backup Script


    Hello yes i was wondering if anyone knows any good simple bash scripts for backing up my hard drive onto a external hard drive>?

  2. #2
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    I use this script to back up one of my folders. you can make changes to it to backup the files to the drive in question I hope this helps



    ###############CODE####################3
    #!/bin/bash
    ## This script uses the tar, mkdir and the cp commands
    ## to create an archive of files and place the files
    ## in an archive directory

    # Scan System for an archive directory
    # if it does not exist, then create the directory
    # Bash variable

    if [ -e $HOME/backups ]
    then
    echo "The Backup Directory exists."
    else
    echo "A Backup directory does not exist, one will be created."
    mkdir $HOME/Backup
    echo "The backup directory has been created."
    fi

    # Define variables and the location of the files to be archived
    FILES=$HOME/SkunkWorks

    # Name of the compressed files
    ARCHIVENAME=Code-`date +%F`.tgz

    # Location of the archive directory
    BACKUPDIR=/home/jraglin/Backup

    # Create compressed archive and copy the compressed
    # files to the Archive directory and Display a status

    tar czf $ARCHIVENAME $FILES
    cp -ap $ARCHIVENAME $BACKUPDIR

    if [ -e $BACKUPDIR/$ARCHIVENAME ]
    then
    echo " The files were backup!"
    else
    echo " The Files were not backup. DEBUG Backup.sh "
    fi

Posting Permissions

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