How often do you run a backup

Discussion in 'Server & Community Management' started by Nebula111, Sep 30, 2013.

  1. Just curious how often everyone runs backups
     
  2. Sway

    Artist Supporter

    At midnight i back all my servers up and i keep 7 of each. Anything older than that is automatically deleted to save disk space.
     
  3. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    Every 6 hours I backup all servers and their files. 6am, 12 noon, 6pm, 12 midnight.
     
  4. prplz

    Supporter

    Worlds every 6 hours kept for 6 days, copied offsite once a day (also kept for 6 days there), I just set up git for plugin backups excluding jars, every 5 minutes. Not sure how that will go :x
     
  5. I back mine up every 12 hours.

    Depending on how lazy you are, You could run a script and it will move it to a folder defined from there on you can move it to a backup ftp or whatever you use.

    now=$(date +"%T") = Defines the variable and gets your server time ($now) (Dedicated server time)

    The * in the line at "mv faction*.zip /backups/faction/" will find everything ending of faction and with a file name of .zip on the end (Hoping you only have 1 backup in that folder)

    The * on the end of the line at "mv faction*.zip /backups/faction/" will zip everything up in the folder you execute the script/command in.

    Code (Text):
    #!/bin/sh
     
    server="faction"
    date=$(date +"%m-%d-%Y")
    now=$(date +"%T")
     
    echo "----------------------------"
    echo "Starting Back Of $server..."
    echo "----------------------------"
     
    zip -r $server$now-$date.zip *
    sleep 1
    mv $server*.zip /backups/$server/
     
    echo "-------------------------------"
    echo "Backup Done Of $server...."
    echo "Created file $server$now-$date.zip"
    echo "In folder /backups/$server/"
    echo "-------------------------------"
     
    #5 shawshark, Sep 30, 2013
    Last edited: Sep 30, 2013
  6. XZo

    XZo


    Don't forget to issue a save-all + a save-off and finally a save-on when your script has finished.


    To answer the OP:

    I try and get around 3-4 backups per week, I run my backup script by hand just so I can spot problems there and then.

    I aim for one backup on a Friday and then one on a Monday, thats peak time covered. I will also do at least one mid week backup without fail. Sometimes I can squeeze an extra one in if the server is low on players.

    The most important thing though, is having this backup offsite (e.g another server or at home), backups are of zero use if they are stored on the server that explodes. SFTP is great for this.

    I really need some sort of efficient way to backup my logback database, its simply too big to tackle it seems.
     
  7. I backup locally every 6 hours, and remotely every 24 hours.
     
  8. I back up everything every 6 hours.
     
  9. I think your script is pretty sufficient. I have simply been running them manually, however I modified your script a tad to make for smaller file size and added some checking.

    This is my revision:
    Code (Text):
    #!/bin/sh
     
    server="SMP"
    date=$(date +"%m-%d-%Y")
    now=$(date +"%T")
    filename="$server-$now-$date"
     
    echo "----------------------------"
    echo "Starting Back of $server..."
    echo "----------------------------"
    echo "Checking if backup folder exists..."
     
    if [ ! -d /backups/$server ];
      then
        mkdir -p /backups/$server;
        echo "Created folder /backups/$server"
      else
        echo "Folder already exists. Proceeding..."
    fi;
     
    echo "Compressing data...."
    tar cvf -  * | gzip -9 - > $filename.tar.gz
    sleep 1
    mv $server*.tar.gz /backups/$server/
     
    echo "-------------------------------"
    echo "Backup Complete for $server...."
    echo "Created file $filename.tar.gz"
    echo "In folder /backups/$server/"
    echo "Complete Path: /backups/$server/$filename.tar.gz"
    echo "-------------------------------"
     
  10. While you are at it... do you think you can also issue a save-all, save-off and save-on in the script? Seems like a good script which I'd like to use. :3
     
  11. I run backups through cron jobs on 9am, 12pm, 3pm, 6pm and 9pm. Not for all servers, though. Only for build type servers.
     
  12. Someone knows if is possibile to execute save-off save-all save-on from a sh script? If possible how? Thanks
     
  13. You'll probably have to send a command to the screen.
    Code (Text):
    screen -S sessionname -p windowname -X stuff 'save-off
    save-all
    save-on'
    I never did this and didn't test this. Just looked it up on the internet.
     
  14. Here is my script.
    Code (Text):

    #!/bin/sh
    TIME=`date +"%T-%b-%d-%y"` #Define the time format
     
    screen -S ecorestart -X eval 'stuff "say Backup creation in progress, you may experience lag\015"'
     
    #Economy
    screen -S ecorestart -X eval 'stuff "save-all\015"' #Save the economy server
    screen -S ecorestart -X eval 'stuff "save-off\015"' #Turn off saving
    zip -r /home/backups/economy/$TIME-backup.zip /home/minecraft/economy #Create a backup of the economy server
    screen -S ecorestart -X eval 'stuff "save-on\015"' #Turn on saving
     
    #Bungee
    zip -r /home/backups/bungee/$TIME-backup.zip /home/minecraft/bungee #Create a backup of the bungee server
     
    #MySQL
    mysqldump -u root -ppassword economy > /home/backups/mysql/economy/$TIME-economy.sql #Backup the economy database
     
    screen -S ecorestart -X eval 'stuff "say Backup complete\015"'
     
    I use a crontab to run this every 6 hours at Midnight, 6:00 AM, Noon, and 6:00 PM
     
  15. Not often enough.
     
    • Funny Funny x 1
    • Like Like x 1
  16. I have a lot of backups and 2 of each
    MySQL Tables: Every 6 hours. Keep for 7 days
    Maps: Every hour. Keep for 7 days
    Plugin configs: Every 12 hours. Keep for 1 month
    Whole server: Every 24 hours. Keep for 7 days