Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Redis-Database backup shell script
- # Copyright (C) 2015 Halvhjearne
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- # Contact : halvhjearne@gmail.com
- # set path to where your redis.rdb file is located
- REDISDBDIR=/var/lib/redis
- # set path to where you want the db file to end up
- DBBACKUPDIR=/media/4y3rt6fd-4f5g-6543-4366-6fa2b6d58a28/armabackup
- ##########################################################
- # Dont touch this part #
- ##########################################################
- DBDIR=$DBBACKUPDIR/$(date +'%A')
- DBFILE=dump_$(date +%Y_%d-%m_%H.%M-%S).rdb
- DBNAMEINDIR=$DBDIR/$DBFILE
- if [ -d $DBDIR ];then
- echo "Dir '$(date +'%A')' already exists"
- else
- echo "Creating $DBDIR"
- mkdir -p "$DBDIR"
- fi
- echo "Backing up Database To $DBNAMEINDIR ..."
- cp $REDISDBDIR/dump.rdb $DBNAMEINDIR
- chmod 775 $DBNAMEINDIR
- ##########################################################
- # Change how long you want to save a database copy below #
- ##########################################################
- #show old db's, uncomment to use:
- #-mmin = +minutes
- #find ${DBBACKUPDIR} -type f -mmin +240
- #-mtime = +days
- #find ${DBBACKUPDIR} -type f -mtime +3
- ################## IMPORTANT: ############################
- # delete db's older than 7days, change the 7 below #
- # or comment out with a # infront of the line to disable #
- ##########################################################
- #find $DBBACKUPDIR -type f -mtime +7 -delete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement