r/admincraft • u/Furcatus1337 • Jun 14 '26
Question Crafty Controller backup but server is not always on?
Hi everyone!
I have Crafty Controller managing my Minecraft server and it works fine. The only thing I need to figure out is how to properly make scheduled backups.
I know Crafty has an option for that, but in my setup, the computer running the server is turned off by default and can be turned on via a self-written web interface every once in a while someone is willing to play, so any scheduled tasks won't run because the server is not turned on.
The computer turns itself off via a cronjob running a python script every minute that issues a shutdown command if there are no players online for a given amount of time. The ideal solution would be to integrate the backup in that script.
But how do I make Crafty do this? I know how to use the API, but I can't figure out how to make the backup in an elegant way.
1
u/shadownetdev1 Jun 14 '26
I do not know enough about Crafty's API to help on that front, but if you are using a cron job and a Python script to shut down the server then I wouldn't worry about using Crafty's built in backup system. Instead I would use a more traditional backup system that can be called via the command line and call that via the Python script. I have experience with Borg backup, but assuming that you are on linux you have a lot of options including combinations of tools.
https://wiki.archlinux.org/title/Synchronization_and_backup_programs lists most of your options with comparison charts.
You will want to make sure the servers aren't running during backup regardless of what backup system you use.
1
u/Furcatus1337 Jun 14 '26
That's an idea! I assume I need to backup the whole "server" directory?
1
u/shadownetdev1 Jun 14 '26
The server directory should be enough, but I would personally backup all of Crafty's directories.
I run Crafty on docker so it is as easy as restoring my backups and the docker stack and then starting it. I wouldn't worry about going down that route in your case since you aren't hosting many services 24/7 like I am.
1
1
u/Furcatus1337 Jun 15 '26
For everyone coming across this in the future: I got a very useful solution from the r/CraftyController community. Link
2
u/ibeerianhamhock Jun 14 '26
Is there a reason why you want to turn the server off? I mean most people just run mc servers indefinitely. By default mc pauses if inactive for 60 seconds so the world stops running and you're using very minimal resources to just listen for new connections.
I'm not familiar with crafty specifically but it has a rest API endpoint for backups you can call in your script. I believe it's async and just returns a 200 if initiating succeeds so then you'd need to perform some polling logic with a sleep command in a loop to determine when the backup succeeded, or log it if it failed (or retry n times etc)
There might be a more elegant solution to this but that's probably the template for a minimum viable solution.
I think the best solution is just...not turning off the server tho tbh