System reboot, followed by server starting automatically


#1

Hello,

I’ve looked everywhere on this forum this morning to find a way to reboot my system and then have the server follow along, I found nothing…

I would like the system to reboot it’s self at 00:00, 06:00, 12:00 and at 18:00 too. I’m sure you’d use contrabs, but how?
How would I make the Minecraft server boot aswell once the server comes along?
Could someone please give me a detailed discription on how to do this? Thanks!

There are many reasons for this, for releaving cache, this odd memory issue, and a few more. I need a restart and not the “normal” ways of fixing this because the machine is a bit old.*


#2

This has been explored here:


#3

I’ve looked into this thread alot, after and before the time of posting - I don’t understand it! It doesn’t explain what I need.


#4

Alright, well first things first:

  1. MineOS–when configured–will take care of starting the server up automatically. That means in the webui, go to your server’s page and enable “start server at boot” option. So you just need to worry about the restart…

  2. A daily system reboot is a crontab task that is independent of MineOS; Using any tutorial you want that is intended for Debian or Ubuntu will work precisely on MineOS too (because that is what MineOS is based off).

Therefore, a nightly reboot can be solved with the solutions here:


or

or
https://ubuntuforums.org/showthread.php?t=1881382

OR – other ways you might discover elsewhere for Debian/ubuntu-based systems. (and to be fully accurate, it doesn’t even have to be for a Debian-based system…it’s just that there is enough tutorials out there regarding these systems that there’s no reason to get caught up in every-now-and-then differences between Debian and other Linux flavors).

But last point, I feel like a daily reboot is overkill for a system that–by design–is meant to maximize uptime. Clearing the caches is not a particularly valuable thing to do (because anything that is cleared has to be reloaded at the cost of I/O) and things that are no longer being used (in game) typically find a way to get released and made available for other resources.

But alas, if your circumstances are definitely requiring a reboot… then the links in this post should guide you there.


#5

Thanks William(?) - I feel a bit foolish not seeing the startup at boot selection.
I’ve read through these posts, so I need to run this:

"sudo crontrab -e (Return)

0 0 * * * reboot (Return)

0 6 * * * reboot (Return)

0 12 * * * reboot (Return)

0 18 * * * reboot (Return)"

Just to confirm before I do anything.


#6

Also, do I need to add “stop” cronjob’s in the WebUI for the server,
but, where and how will I apply these?:

"sudo crontrab -e (Return)

0 0 * * * reboot (Return)

0 6 * * * reboot (Return)

0 12 * * * reboot (Return)

0 18 * * * reboot (Return)"


#7

Yes, this is necessary if you want a graceful shutdown of your servers (and to minimize risk of lost play).

MineOS already offers the auto-save interval in the webui, but obviously even the smallest amount of unsaved work is undesirable. As demonstrated in the link @iMelsom provided above, you’ll want to create a script that will run on the cronjob rather than add commands directly to the cronjob.

Also see this link for ideas on what you would execute to stop the servers:

cd /usr/games/minecraft
./mineos_console.js -s myserver stop

The reason you don’t want this in a crontab directly is because (while possible) it is less clean and straightforward to have each of your commands execute in the order you want it to. If you have as script, e.g., “shutdown.sh” that changes directory to the Minecraft scripts directory, shuts down the servers, (waits for servers to definitely be down), and then tell the OS to shut down, it’s much more reliable than simply having each happen, say, one minute after eachother in crontabs.


#8

I feel really stupid, I don’t understand on how to do it.
I get now I need to add some sort of crontab which runs a script, not just reboot.
I did ask at the start that I need a detailed explanation on how to do this,

Step, by step if you wouldn’t mind, thanks.
Here’s what I think I need to do:
Open PuTTY,
Run “crontab -e”
Type my crons’ on the non-hash lines, (But what command/dictionary is the reboot script, for the actuall system and stop for server?)
Then use Ctrl+X to save these, then I can close PuTTY, then it should be alright?


#9

Hi again.
@hexparrot earlier in this thread said that he did not really understand your immense need for reebooting, since the things that are reset by the reboot are system files and memory usage. Things your system needs and uses all the time.

Also: A minecraft server that kicks everybody out and restarts every 6 hours? I do not restart my server(s) unless I really really have to, and then it is only due to necesary upgrades and such. IF your system is bogged down and needs a restart that often you should really take a good look at your resource needs VS availability and usage. Things to look at:

  • How many minecraft servers are your MineOS server running?
  • How many of them are of the FTB type?
  • How much memory do you have physically in your machine?
  • How much memory (in total) have you allowed your minecraft servers to use?

As a good tip: The total amount of Xmx-memory allowed for all your minecraft servers should not exceed the amount of physical memory you have. If you have 4GB of RAM available physically you may have 4 minecraft servers using 1 GB each, or one using 2 GB, on at 1GB and two at 0.5GB, or any other combo of memory assignments, as long as the total do not exceed your max available.

(Sidenote: If you are running on a Virtual Machine (VM) max physical memory would equal the amount of memory your Virtual machine is assigned)

OH! And remember that your system needs some memory for it self.

Now as for your need for step by steps:
The post linked really have all the steps listed. I’m not sure how much easier we can make it, other than copy-pasting the info from that post into a list in here. And to continue this rant as the sour grumpypot I obviously are right now: I also feel that Being a Minecraft and MineOS admin relies on the admin having some linux knowledge. There are a lot of other things you need to do in the background to admin this kind of server, MineOS is really just a frontend for administrating the minecraft servers. You have to know how to admin the MineOS server as well, and MineOS it self do not do that.

The post linked to, and @hexparrot, mentioned a .sh script: Learn more about shell scripting here: http://www.shellscript.sh/

You need to know how to use the shell, since the linux beneath MineOS do not have a GUI: Learn here: http://ryanstutorials.net/linuxtutorial/

You also need to know cron and how to use and configure them: https://help.ubuntu.com/community/CronHowto

I’ll stumble over to my porch again and stop waiving my walking stick at you. Good luck

(edits: Just removed some really embarrasing spelling errors…)


#10

Right, I’ve read through it now, and I understand it - I get what I need to do.
I’m familar with Linux, we’re good friends.
I run 1, Spigot server with 2GBs assigned to it with about 1GB free for the OS. That may be generous, but it works. Thanks for writing an essay on how to help, it’s what I needed to understand rather than having to put the pieces together myself.

Many, many, many thanks towards both of you.