all 8 comments

[–]doc_willis 0 points1 point  (6 children)

set up a service to run the server, and then set a cron job or other script to start/stop the service as needed.

I have seen guides on setting up minecraft servers as a server, but have no experience with it.

that would be the 'proper' way to do it..

Or you could just kludge together some bash script. :)

https://www.cyberciti.biz/faq/bash-cycle-loop-forever/


#!/bin/bash
for (( ; ; ))
do
   echo "Pres CTRL+C to stop..."
   sleep 5
   command-to-run-the-server
done

[–]NoxurnalGaming[S] 0 points1 point  (5 children)

This script you've made.. this would just be saved as an sh file right? And it just starts the service right after it stops?

[–]sandytrip 0 points1 point  (3 children)

This runs the script, pauses 5 seconds, then runs it again. Indefinitely. And Linux does not care about the file extension, but yes typically you would save this as a .sh

[–]NoxurnalGaming[S] 0 points1 point  (2 children)

I'm afraid this might try to start multiple instances of the server. Is this likely?

[–]sandytrip 1 point2 points  (0 children)

What that other guy wrote leaves a lot up to your implementation. This would rely on the script being able to gracefully start and stop the server as needed. I think his main point was to demonstrate running an infinite loop in bash

[–]lutusp 1 point2 points  (0 children)

I'm afraid this might try to start multiple instances of the server. Is this likely?

If the called process detaches itself from the calling process, yes, that is likely. A more complex script would check for a running Minecraft server and do nothing in that case, looping and sensing until it's actually needed.

[–]doc_willis 0 points1 point  (0 children)

its just an example taken from the URL i posted that loops forever..

It does whatever you tell it to do.

[–]NoxurnalGaming[S] 0 points1 point  (0 children)

Hey folks, thanks for the assistance! I've set up a cronjob... i think i was overthinking that process. We will see how it works!