I’m running MineOS on my machine and randomly have servers not starting on reboot. I’m checking in with this on the spigot forums but it also got me thinking.
I have 5 servers starting at once, 4 spigots and 1 bungeecord. Is there some way to delay the start of each server? Perhaps separate each by 10 seconds?
I think the only way is disabling start on reboot in WebUI and @reboot sudo -u mc \path\to\script.sh
line in crontab with script like
#!/bin/bash
sleep 10 # To be sure all is loaded
cd /usr/games/minecraft
./mineos_console.py -s myservername1 start
sleep 10
./mineos_console.py -s myservername2 start
sleep 10
./mineos_console.py -s myservername3 start
sleep 10
./mineos_console.py -s myservername4 start
sleep 10
./mineos_console.py -s myservername5 start
In terms of adjusting the python code to do this, it should be fairly easy (even if it’s not yet implemented). The lines we’re looking at are these:
I suspect the code change should pretty much be this at line 114:
elif args.cmd == 'start':
from procfs_reader import path_owner
from time import sleep
for i in mc.list_servers_start_at_boot(args.base_directory):
try:
owner = path_owner(os.path.join(args.base_directory, mc.DEFAULT_PATHS['servers'], i))
print 'starting %s...' % i,
mc(i, owner, args.base_directory).start()
print ' done'
except Exception as ex:
print ex.message
else:
sleep(10)
In fact, I’m pretty much 100% that that is exactly the change required, though I don’t have the chance right now to verify. This might be something I’ll want pushed to all installs, since it seems fairly useful.
Did you implement this in mineos-node?
Yes, this is implemented in mineos-node.
1 Like