So, this is a rather odd request of a backup solution, but it’s kinda what I want right now.

I’m still relatively new to Linux and self-hosting in general

A few years ago, my cousin and I were hosting our own Minecraft server. It had a mod that would create backups of the world folder. It zipped it up, named it “yyyy-mm-dd.zip” and placed it in a backups folder somewhere on the server.

The most important feature that I want is actually the next part. It would allow us to specify how many backups we wanted to keep, and also how frequent we wanted the backup to run.

We set it to backup daily, and keep 14 days of backups. After that, it would delete the oldest one, and make a new backup.

I would like to replicate that functionality! Specify the frequency, but ALSO how many backups to keep.

Idk if it’s asking too much. I’ve tried doing some research, but I’m not sure where to start.

Ideally I’d like something I can host on docker. Maybe connect to a Google account or something so it can be off-site.

I only want to use it for docker config files, compose files, container folders, etc.

I’ve looked into restic, but it seems it encrypts the backups, and you NEED a working copy of restic to restore? I’d like something simple like a .zip file instead or something, to be able to just download, unzip, and spin up the compose file and stuff.

Sorry for the wall of text, thanks in advance if you have any suggestions!

P.S. I’m pretty sure the upload to Google or some other service would have to be a separate program, so I’m looking into that as well.

  • sczlbutt@lemmy.pubsub.fun
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    What you want is a bash script and a cron job that calls it. Most of what you need is likely already installed for you.

    “crontab -e” will pull up your crontab editor. Check out “man crontab” first to get an idea of the syntax…it looks complicated at first but it’s actually really easy once you get the hang of it.

    Your script will call tar to create your backup archive. You’ll need the path to the folder where your files to backup are and then something like: tar -C PATH_TO_FILES -czf PATH_AND_NAME_OF_BACKUP.tgz .

    That last dot tells it to tar up everything in the current folder. You can also use backticks to call programs in line…like date (man date). So if your server software lives in /opt/server and your config files you want to backup are in /opt/server/conf and you want to store the backups in /home/backups you could do something like:

    tar -C /opt/server/conf -czf /home/backups/server_bkup.`date +%Y%m%d`.tgz .
    

    Which would call tar, tell it to change directory (-C) to /opt/server/conf and then create (-c) +gzip (-z) into file (-f) /home/backups/blah.tgz everything in the new current directory (.)

    I don’t know if that’s what you’re looking for but that would be the easiest way to do it…sorry for potato formatting but I’m on mobile

    • 子犬です@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      No honestly, this was very helpful!

      This, in combination with the solutions some others have suggested here already, would be pretty much what I want, just in multiple different parts, instead of 1 program/utility.

      I’ll def look into this, and honestly see if I can find a docker image for something like this as well!!

      Thank you so much!!!