Backup shell script

By | June 14, 2019

One of the best and easy ways to backup a system is using a shell script, Using script we can take backup of directories and files or can move one location to otherĀ 

#Purpose = Backup of Important Data
#Version 1.0
# This Command will add date in Backup File Name.
TIME=`date +%b-%d-%y` 
# Here i define Backup file name format.
# Location of Important Data Directory (Source of backup).       
tar -cpvzf $FILENAME -P $SRCDIR > $File
if test $status -eq 0
 echo "sucess"
  echo "failed need to check"
size=$(du -sh $FILENAME)
line=$(wc -l $File)
echo Size of the tar is $size
echo Total verbose lines is $line


I am saving this file as with name “” location

The backup script is set up a cron
Cron: We can automate execute script or command.

45 23 * * 6 sh /home//

Will run this scriot 23:45 ( 11:45 PM ) every Saturday and we will get backup

Syntax of corn

# * * * * * command to execute

Leave a Reply

Your email address will not be published. Required fields are marked *