So I have a mineraft server and I want to set it up so that it restarts at 6am and backs up itself too. I run the server in screen and to stop the server I have to open the screen (with
screen -r) and run
/stop in the MC server console. I would then like the computer to automatically copy the server world file to a backup somewhere maybe with the format
PATH/TO/DIRECTORY/worldBackupDD.MM.YY/. And then after that the script would run
sudo java -Xmx8G -Xms8G -jar /PATH/TO/DIRECTORY/server.jar nogui to start the server again in screen.
So what I want to do is (at 6am) stop the server, backup the server, then start the server again in screen. So how do I do this? Would I use cron? I don't really know how to set this up or how to do this in cron. Or would I do it another way? Any help would be appreciated.
(btw the server runs on ubuntu server 18.04)