MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
490 stars 61 forks source link

mscs.properties not being respected with mscs restart in crontab #199

Closed ForestFeather closed 5 years ago

ForestFeather commented 5 years ago

Hello,

When using a crontab entry for the 'minecraft' user as defined below:

0 1,9.17 * mscs restart

and is a 1.12.2 forge server, it has three times now destroyed the world by using the 1.12.2 server jar, rather than the forge world jar. It's also not respecting the custom RAM and variables settings, apparently using only the ones from my default mscs.properties file that I have defined.

When I manually stop the server, start the server, or restart, it uses the correct jar, but the very next crontab initiated one by the 'minecraft' user it stops working. All files and paths are owned by the 'minecraft' user so I find myself very confused and hoping for some help identifying this. Thank you!

here's the contents of the forge world's mscs.properties file:

mscs-enabled=true mscs-client-version=1.12.2 mscs-server-version=1.12.2 mscs-minimum-memory=512M mscs-maximum-memory=3584M mscs-server-jar=forge-1.12.2-14.23.5.2772-universal.jar mscs-server-url= mscs-server-command=$JAVA -Xms$INITIAL_MEMORY -Xmx$MAXIMUM_MEMORY -XX:MaxPermSize=256M -XX:PermSize=128M -Xnoclassgc -jar $SERVER_LOCATION/$SERVER_JAR $SERVER_ARGS

Roflicide commented 5 years ago

Hi,

I don't think that is correct crontab syntax -- I put it into this website to check it and there appears to be an error

How often were you wanting to restart the server?

sandain commented 5 years ago

mscs-minimum-memory=512M

This should be

mscs-initial-memory=512M
ForestFeather commented 5 years ago

Hi,

I don't think that is correct crontab syntax -- I put it into this website to check it and there appears to be an error

How often were you wanting to restart the server?

It works; and I know it works - it's the same one I've used for all my other servers for the last two years. It might just not have copied quite correctly here, I've never had much luck with that.

ForestFeather commented 5 years ago

mscs-minimum-memory=512M

This should be

mscs-initial-memory=512M

I've made that change, but would that have defaulted it to using the master mscs.properties rather than the local one? I'd rather not lose my server (again) if I can help it!

sandain commented 5 years ago

0 1,9.17 * mscs restart

I think what you want here is to change that period to a comma:

0 1,9,17 * * * mscs restart

I've made that change, but would that have defaulted it to using the master mscs.properties rather than the local one? I'd rather not lose my server (again) if I can help it!

I don't know if this would fix the problem, I'm just trying to rule out the easy stuff. Make sure you have a backup of the world before you try.

I have one other thought: make sure the PATH is being passed correctly. Directions are provided in the README

sandain commented 5 years ago

If none of that fixes it, my guess is that the script is unable to find your mscs.properties file. Where do you keep your install, /opt/mscs as recommend, or somewhere else? Similar to the PATH mentioned above, you could try passing HOME. Just add something like the following after PATH in your crontab file:

HOME=/opt/mscs
ForestFeather commented 5 years ago

If none of that fixes it, my guess is that the script is unable to find your mscs.properties file. Where do you keep your install, /opt/mscs as recommend, or somewhere else? Similar to the PATH mentioned above, you could try passing HOME. Just add something like the following after PATH in your crontab file:

HOME=/opt/mscs

This seems to have done it; I've not seen it restart with the wrong server jar.

Not sure why it'd work with an older forge server and the new one had this issue, repeatedly, but seems good now.

Thank you!

sandain commented 5 years ago

Good. I'm glad that worked for you!

sandain commented 5 years ago

I just pushed commit 11ccfc77ac3a0319f0767ee79e0ff6715dbaec4d so that we better document the need for HOME with cron