Backup through script on Centos, Redhat, Fedora ( Any flavor of Linux )
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
*********************************************************************************
**************************************Enjoy *************************************
*********************************************************************************
No comments:
Post a Comment