Jump to content

darthmard

Member
  • Posts

    22
  • Joined

  • Last visited

Reputation Activity

  1. Like
    darthmard got a reaction from Caveman1 in Redis Backup with batch - simple   
    I put together some code for a simple Redis backup for command I use it myself in a windows task simple to use for new server owners who like to use batch files.
    I know there's programs for this but I like to use batch files if done right uses less resources on server.
     
    Make a batch file (Backup.bat) or use in own restart batch if have one.
    @echo off color 0A echo Running Redis Database Backup.. echo. echo. IF Not EXIST C:\Database\dump.rdb GOTO DoNothing if not exist "C:\Database\backup" mkdir C:\Database\backup :: above checks for folders and file :: :: DO NOT EDIT for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j echo Date: %yyyymmdd% for /F "tokens=1-2 delims=: " %%l in ('time /t') do set hhmm=%%l%%m echo Time: %hhmm% :: END NO EDIT :: copy C:\Database\dump.rdb C:\Database\backup\dump.rdb :: REN C:\Database\backup\dump.rdb dump_%yyyymmdd%_%hhmm%.rdb echo. echo Backup was successfully completed! timeout 10 :: :: You can add database startup here if you want :: START redis-server.exe redis.conf :: echo Database started successfully! ::timout 10 exit This code will save DBdump.rdb and move to backup and rename it this example: dump_20150207_0201.rdb
     
    NOTE: I have my redis in c:\database you can edit this in batch code
     
×
×
  • Create New...