20 Jun
Shell script to create backup or backup tar
On linux based server many time we need daily backup of particular folder. Her i am writing simple script which make a tar of your folder and move it to your backup folder.
#!/bin/bash #Purpose = Backup of Important Data #Created on 18-06-2015 #Author = Rajeev Achra [email protected] #Version 1.0 #START TIME=`date +%Y%m%d ` # This Command will add date in Backup File Name. FILENAME=backup-$TIME.tar.gz # Here i define Backup file name format. SRCDIR=/source_path # Location of Important Data Directory (Source of backup). DESDIR=/dest_path/ # Destination of backup file. tar -cpzf $DESDIR/$FILENAME $SRCDIR #END
It’s basic script which gave you an idea how to use shell for creating a tar or zip backup file. You can add extra or can modify according to your requirement.
I am a software engineer who specializes in Internet applications. I have worked with a wide variety of technologies and programming languages to open source LAMP environments. I have more than 6 years of object-oriented programming experience and am highly proficient in ActionScript, PHP, MYSQL, JavaScript, Jquery and a multitude of other technologies used in modern web applications.
Follow me
Latest posts by Rajeev Achra (see all)
- Jquery webcam plugin - June 19, 2016
- How To Add and Delete Users on a CentOSServer - June 5, 2016
- How To Set Up vsftpd on CentOS 6 - June 5, 2016