C3rd
Bash: File Server Hourly Backup Script
Posted: 11 May 2016, 3:04am - WednesdayBeen creating bash backup scripts but every time I create for the new server, I forgot the commands and research again. This time, I'm gonna save it in my blog so that I will search it in one place. Hehehe...
#!/bin/bash cd /backup/ DATE=$(date "+%Y%m%d%H%M%S") BACKUPNAME="jdrive_$DATE" mkdir $BACKUPNAME # find -mtime -1 | xargs cp -t --parents "$BACKUPNAME/" find /jdrive/ -mmin -60 -exec cp --parents '{}' "$BACKUPNAME/" \; tar -zcvf "ibackup/$BACKUPNAME.tar.gz" "$BACKUPNAME/" rm -rf "$BACKUPNAME/" # file and delete all files smaller than the specified filesize find /backup/ibackup/ -name "*.gz" -size -500 -delete # file and delete all files that are older than 45 days find /backup/ibackup/ -mtime +45 -type f -exec rm -rf {} \;Here you go... My home-brewed incremental backup script. We usually use duplicity but it failed us twice. So, we are using now both my home-brewed script and duplicity. Oh! by the way, I used this script for our file server only.
Search
Categories
Related Links
- Apache Web Server
- ASP Immigration Services Ltd.
- CentOS Linux
- Color Scheme Picker
- CSS Button Generator
- Deviant Art Account
- Don Tabaniag - GraphiCult
- Jerson Maglasang Weblog
- Joshua Manlunas
- Mark "mungkey" Vicente
- Matt Arnilo Baluyos
- MySQL
- Paul Labis
- PHP
- PrendStar
- Ridvan Baluyos
- Scott Davies
- SEO Fart XML-RPC Ping Tool
- Stripes Generator
- The Hero
- Ubuntu Linux
- Vim Carlo Nabora (DA)
- Wella Maria Hong
- What is my IP?
- Xavier University - Ateneo de Cagayan
- Zabyer Community