Monday, 22 July 2013

Take Backup through script on linux



Through this script , we can take backup of file , folder , any drive etc 

Create a folder to take backup . For Example :-

$mkdir ~/backup/
$cd  /usr/local/bin/
$vi backup.sh
***********************************************************************************
***********************************************************************************
         #!/bin/bash
         # A script for backing up any file & folder
         # First argument : The directory to be backed up
         # Second argument : The location to back-up to.
                        ORIG=$1
                        BACK=~/backups/

          if [ -e $BACK ]
          then
                        echo "WARNING:$BACK exists"
                        read -p "Press Ctrl+c to exit or Enter to Proceed:"
          fi
          cp -av $ORIG $BACK
          echo "Backup of $ORIG to $BACK completed at:$(date)"


       :wq
************************************************************************************
************************************************************************************
$ chmod 755 backup.sh
$ backup  (Path of file & folder Only )
$ cd  ~/backup/
$ ls -l                                             ( Your all backup in this folder )


*********************************************************************************
**************************************Enjoy *************************************
*********************************************************************************

Enjoy , if  you like my blog . please write the comment .


Ravi Ranjan Kr Singh
If you like my blog than please Donate

PAYTM 

No comments:

Post a Comment

Linux Solutions

How to install Xvidcap on ubuntu 13.04 or 12.04 step by step ?

To install Xvidcap on ubuntu 13.04 or 12.04 step by step Xvidcap is desktop movement capture tool to convert on video format . This soft...