Using .sh file as runnable


#1

I’m trying to create an Enigmatic 2 lite server. the server provides a serverstartlinux.sh for running it in a Linux environment. Is there any way to use that file instead of just running the standard forge universal jar that it uses. I have looked at the file and it basically is executing the jar file, but it has a script for checks before running the server. It also installs the forge and minecraft server.


#2

TLDR; With the current version of MineOS support for this is not programmed in.

.sh files are runnable shell command lists, and there are no spesific problem in getting MineOS to run a .sh instead for a .jar. This is a function that has to be programmed in by someone. Parts of this is alleady added for the “install forge” button, but that button looks for a spesific file and runs that. You could probably trinck MineOS to run your file instead for the file MineOS looks for, by naming your file the name MineOS looks for. This will most likely not work as you want, the server will probably start, but MineOS likely not “see” the running server since it is not started with the start button (Start button fires up a named screen session it runs your server in, and this is also where it looks to find data about your server).

Without seeing the actual contents of the script, and basing this only on what you wrote, we can break the .sh down in three parts:

  1. the check
  2. the installation and compilation of forge
  3. the running of the jar.

I don’t know what checks do, but I can’t imagine they do much more than what MineOS itself allready do autmatically when managing your server

Installation and compilation: This is exactly what the “install” button in the webUI do…

Run the jar. the only important bit, since this actually starts your server. If there are spesific java arguments the .sh file uses, you can actually copy them out, and add them to the server jar argument field, and MineOS will also run those arguments when starting your server.

MineOS is opensource and on Git, so you can actually download the source code, and try to add the function to run with .sh files if you wish, I do however not wuite see the need, as the file probably do no more than MIneOS allready handles internally.


#3

That sounds right. I don’t know how mineos handles the server, but I’ve made a pastebin for code in the file. maybe you can get a better look at what it does and see what it does extra other than mineos. link to the Pastebin: https://pastebin.com/tu9vu4xC

I’ll try to look at the code.


#4

The script checks the following variables:

  • *nix variant and version
  • If forge is installed or not, and if you want to reinstall forge
  • what directory you are in when trying to start the server
  • read/write access to srever folder
  • internet connectivity
  • if all needed jars are present
  • if the EULA-file is present

Breakdown of checks:

  • nixvariant:
    Not really needed. your script only checks this to log it

  • installation status of forge
    Needed for standalone running, Under MineOS this is handled by the “install forge” button.

  • Current directory / read / write:
    Nice for standalone running to eliminate user errors. MineOS do not need to check those because it knows it has the proper rights, and what folder it starts the server from. The only way for MineOS to get read/write troubles is if you use the “root” user to log into MineOS and add /manage servers, or manually copy in server structures as a different user than MineOS uses (Default MineOS user = “mc”).

  • Internet connectivity:
    Nice to have function to help eliminate user /network errors. Not really needed.

  • Precense of all needed jars
    Needed for standalone running to eliminate user errors. MineOS handles this itself (Seen by the install button and the dropdown jar list)

  • EULA file
    needed for standalone running. Handled by MineOS autmatically.

The script stores a few variables in a config file, and writes results in a log file
MineOS logs everything it does in /var/log/mineos.log
The server itself logs everything it does in one or more log files in the server directories (depending on server type).

The script starts the jar with the following command and settings:
java -Xmx${MAX_RAM} ${JAVA_ARGS} -jar forge-${MCVER}-${FORGEVER}-universal.jar nogui

Which are the same way Mineos starts the server inside a screen session.

My conclusion is that you do not really need the script when running this server through MineOS.
Using it may disrupt MineOS’s ability to controll your server through.


#5

Thanks for the quick answer. it is nice the get quick support.