Simple Automated Backup Script v0.5b - Updated 3/20/14

Discussion in 'Server & Community Management' started by eNkrypt, Oct 1, 2013.

Thread Status:
Not open for further replies.
  1. Ash


    to save all does it use "/save-all" or "save-all" because i use mcmyadmin (only for it's mobile app) and if i am not mistaken mcmyadmin console does it via "/COMMAND"
  2. LiLChris

    LiLChris Retired Moderator

    Just change the commands in the script.

  3. Ash Actually, I have a check for this in the code - Once you start configuring the script you will run into this line:
    Code (Text):
    #Using server container like McMyAdmin?
    #In otherwords should I issue commands to the screen with /command or simply command
    Change that to true and you should be fine.
  4. Ash


    My bad, i did not read the script i simply asked away but Thanks :)
  5. Ash - No problem :)

    Also, I can confirm this version working:

    Code (Text):
    Backup Complete for SMP_Classic....
    Created file SMP_Classic-11-19-2013-22:20:56.tar.gz
    Local complete path: /backups/SMP_Classic/SMP_Classic-11-19-2013-22:20:56.tar.gz
    Time Taken: 15 minute(s)
    Size of SMP_Classic-11-19-2013-22:20:56.tar.gz is 10815819675 bytes.
    Thanks for using SABS v0.3b!
    Excluding dynmap took about an hour off the total execution time :)
  6. Thanks eNkrypt . He helped me via PM :)
    will post results after i get home to test it fully!
  7. I have encounted some error using this script.

    Code (Text): 53: [[: not found 57: save-all=/save-all: not found 58: save-off=/save-off: not found 64: [[: not found
    • sh shows error using [[ and ]]. I changed #! /bin/sh to #!/bin/bash
    • save-all was not a valid variable under bash. I changed save-all to saveall
    • bc has to be added to requirements
    hope this helps
  8. Can I use this script to backup more than 1 server?
  9. Yes, all you would have to do is specify which directory you would want to backup. If needed, you can run two copies of the script on two different servers.

    It would appear that my server was skipping the errors and running the script anyways.
    This is my mistake, I should have known you can't use "[[" in sh - I will convert all if statements to "["

    An update is inbound: Fixed some errors people were having as well as fixed a server save error. In version 0.3 and below the server $saveon was not defined so the script would not turn saving back on. This will be fixed in SABS v0.4b which I am about to post.

  10. Lets say that I have 1 box running 3 servers + bungeecord server. How would I set the script up? :D
  11. What are the full paths to the servers?
  12. Skywars - /home/skywars/server
    Factions - /home/orioncraft/server
    Prison - /home/prison/server
    Hub - /home/minecraft/hub
    Bungeee - /home/minecraft/server
    #52 orion6666, Feb 17, 2014
    Last edited: Feb 17, 2014
    • Agree Agree x 1
  13. This is what I would do, since I do not currently have the script setup to backup each server individually into a separate tar.gz file.

    Create 3 (because it looks like a few of your servers are under the same dir) separate scripts named:

    Configure them to your liking, and make sure you specify all the stuff you want backup up.

    Save them all, then create another file called:

    With the following content:
    Code (Text):

    Then you can run the and it will backup each individual server. Be sure that the scripts are all in the same directory out side of the directories that are to be backed up.

    Having all these separate files may not look ideal, however it allows for much more customization!

    Good luck!
    • Informative Informative x 1
  14. Script Updated to v0.4b
    Change Log:
    Added the ability to delete files older than x amount of days.
    Fixed many of the issues users were having
    Fixed turning save-on where $saveon variable wasn't defined

    I can confirm this working from the following output:
    Code (Text):

    Checking if local backup folder exists...
    Folder already exists. Proceeding...
    Cleaning up files older than +30 days
    Removing the following files:
    Backup Complete for SMP....
    Created file SMP-02-17-2014-10:22:26.tar.gz
    Local complete path: /backups/SMP/SMP-02-17-2014-10:22:26.tar.gz
    Time Taken: 18 minute(s)
    Size of SMP-02-17-2014-10:22:26.tar.gz is 12345702908 bytes.
    Thanks for using SABS v0.4b!
    @boboman13 @LiLChris @joehot200 @McLive @shawshark @Ashour @orion6666 @zeldoso @Ash
    • Like Like x 2

  15. Hey, thanks for this! Really appreciated. You just made my life easier xD

    Opsie wrote it within the quote :p
    #55 orion6666, Feb 17, 2014
    Last edited: Feb 17, 2014
    • Like Like x 1
  16. No problem!

    If you have any other questions PLEASE don't hesitate to ask me :)
    #56 eNkrypt, Feb 17, 2014
    Last edited: Feb 18, 2014
  17. For those of you that are having problems (many people have messaged me)

    It would appear that a lot of users are editing this script in windows then uploading to their server. This can result in invalid return characters from the lines you have edited (shown by the \r)

    Windows formats and saves files weird. If you are going to do it that way I suggest you past the file into notepad then configure the settings, then copy the text.

    Once the text is copied go to your server and vi the bash file and paste the text into the console.

    This usually takes away all the messy saves that windows puts in the files.


    If you want you could try and run this command to your .sh file

    sed -i -e 's/\r$//'

    This should remove any spurious CR characters.
  18. jflory7

    jflory7 Retired Moderator
    Retired Benefactor

    Just an idea, you should add this script to the standalone resources section. :)
    • Like Like x 1
    • Agree Agree x 1

  19. Good idea! Maybe it will get more attention!

    Thanks for the idea =)
    • Friendly Friendly x 1
  20. You should put it up on Github.
Thread Status:
Not open for further replies.