Scripts - estol/org.server.estol.rexServer GitHub Wiki

Overview

External scripts are stored in the server's root directory, in a directory named scripts. The external scripts define what the server is "capable of".

The scripts could be written in any language, as long as the script script, or binary, is runable on the platform the server is running on.

Startup:

The program must parse, and respond appropriately to the following arguments:

  • --describe: describes what the script does. e.g. print something like this to the standard output: "This script will remove the / folder on your system, release the Krakken."

  • --usage: describes how to use the script. e.g. print something like this to the standard output: "yourscript.sh -switch --argument parameter"

  • --crashlog: show the name of the file, the script logs to in case of a crash. This is optional. If "false" is printed to the stdout the server won't look for a crashlog. e.g. print something like this to the standard output: "logs/yourscript.sh.crashlog" OR "false".

Running:

There is a way to access the output of the program, and write some input, but currently no way to tell, if the script is waiting for any input. Any script, or program running when the server is exiting will be terminated.

Return codes:

  • Return code 0: the program exited correctly.
  • Return code ~0: (~0 -> not 0) the program exited incorrectly, will look for the crashlog unless it was defined as false.