If you have question that how to take tar backup by script then here is the solution.
In Linux tar backup is cool idea which make good sense as it allows to create differential archives backup on modified files.
here you go with script and save it as .sh extension file and run on linux system where you want to set backup.
The script is :
tar –create –listed-incremental $LOG_FILE –gzip –verbose –file $TARGETFILEPATH $SOURCEDIR
mkdir -p $FINALBACKUPDIR
cp $TARGETFILEPATH $FINALBACKUPDIR
cp $LOG_FILE $FINALBACKUPDIR
This script you can set as per your requirement to execute. you can place it under /etc/cron.* path as per required.
DATE=$(date +%Y%m%d) : YYYYMMDD
TIME=$(date +%H%M) : HHMM
The file will be in form of “backup_YYYYMMDD.HHMM.tar.gz” and the log file is “backup_YYYYMMDD.snar“.
This article is contributed by RootLinuxBlog. If you like RootLinuxBlog and would like to contribute, you can submit an article using contact us from. See your article appearing on the RootLinuxBlog main page and help other Techies.
Please write comments if you found any error with the above article would really help us to serve you a better way. Thank you…