Script utilities for launching a Minecraft server on Linux in a screen instance.
bashshell and a terminal emulatorpgrep
curlandjq(jqlang) for utilizing the PaperMC download API.- OpenJDK or other JVM for running Minecraft
curlandjq(jqlang) for utilizing Mojang's version manifest API.- OpenJDK or other JVM for running Minecraft
- Forge server installation
- OpenJDK or other JVM for running Minecraft
rdiff-backupfor backups, with the pre-201 CLI- If your distro no longer supplies pre-201 CLI rdiff-backup, modify quickstart.env to use the commented-out rdiff201 option, and ensure BACKUP_DIRECTORY is not set to a subdirectory of install folder.
- quickstart.env can also be modified to use either
rsyncorscpfor backup, if preferable.
screenscreen emulator for Linux- If you do not have
screenor wish to use this quickstart withoutscreen, you may use the run.sh script instead.
- If you do not have
Make sure to mark each script you wish to use as executable in an enable shell:
#> chmod u+x,g+x *.sh
#> chmod u+x,g+x tasks/*.sh
#> chmod u+x,g+x runs/*.shThis quickstart is configured out of the box to download the latest build of the latest version of the PaperMC minecraft server. If you do not wish to use PaperMC, you will need to configure your quickstart.env file. This file can be generated by executing the env.sh script.
$> ./env.sh# This file defines the environment variables available to scripts which source env.sh.
# Environment variables cannot contain spaces or periods in their names.
# You may define your own environment variables at the top of this file.
# Add your custom environment variables here.
##### DO NOT DELETE ENTRIES BELOW THIS LINE #####
# Common environment variables
SCREEN=minecraft_server
RUNAS=isabel
# start.sh options
LAUNCH_CMD="./run.sh"
# run.sh options
RUN_SCRIPT=papermc # Must match the filename of a script in the runs/ folder, sans extension
RUN_SCRIPT_ARGS=(--nogui) # These arguments are passed directly to the script file by run.sh as a bash array. Add more entries for more arguments, such as (--nogui --universe saves --world "my world").
RESTART_WAIT_TIME=10s
# Common arguments for all runs/ scripts
JVM=
# runs/papermc.sh options
PAPERCRAFT_JAR=dynamic # Set this to dynamic to download the latest build from Papers API, or set to a specific jar file.
PAPERCRAFT_VERSION=latest # If PAPERCRAFT_JAR is set to dynamic, this will determine which Minecraft version is downloaded. Set to latest to use the latest version.
# runs/forge.sh options
FORGE_ARGS=@libraries/net/minecraftforge/forge/1.19.2-43.4.16/unix_args.txt # Set this to the args file from your forge installs default script.
# runs/minecraft.sh options
MINECRAFT_JAR=dynamic # Set this to dynamic to download the requested version from Mojang's API, or set to a specific jar file.
MINECRAFT_VERSION=latest # If MINECRAFT_JAR is set to dynamic, this will determine which Minecraft version is downloaded. Set to latest for the latest release, latest-snapshot for the latest snapshot, or an exact version id such as 1.20.4.
# runs/example.sh options
EXAMPLE_SCRIPT_JARFILE=server.jar # Set this to the name of the jar file you want to run.
# backup.sh options
# Select one BACKUP_METHOD from the options below.
BACKUP_METHOD=rdiff # Legacy rdiff-backup CLI. Uses include-filelist.txt to designate included and excluded files and folders. Only enable if your rdiff-backup install supports the deprecated pre-201 CLI.
#BACKUP_METHOD=rdiff201 # New rdiff-backup CLI. Use an external or network folder for BACKUP_DIRECTORY, as include-filelist is no longer used.
#BACKUP_METHOD=rsync # Use rsync instead of rdiff-backup. Use an external or network folder for BACKUP_DIRECTORY, as no files are excluded.
#BACKUP_METHOD=scp # Use secure copy for the backup. Use an external or network folder for BACKUP_DIRECTORY, as no files will be excluded.
BACKUP_DIRECTORY=backups/ # Destination folder for backups. If using rsync or rdiff201, use a folder outside the current directory.
#BACKUP_ARGS=(--no-acls) # Extra args for the backup command as a bash array. For rdiff-backup, these come after the "backup" command. For others, they are passed directly to the command.RUN_SCRIPT_ARGS and BACKUP_ARGS are bash arrays. A single-flag value from before this change, such as RUN_SCRIPT_ARGS=--nogui, keeps working unchanged. A value that packed multiple flags into one string, such as RUN_SCRIPT_ARGS="--nogui --other", needs to be converted to array syntax (RUN_SCRIPT_ARGS=(--nogui --other)) or it will be passed through as a single argument.
You may add custom run script definitions to the runs directory. Three are provided by default, forge.sh, papermc.sh, and minecraft.sh. Custom scripts and arguments can be configured in the quickstart.env file:
...
RUN_SCRIPT=papermc.sh # Change this to the name of the custom script file
RUN_SCRIPT_ARGS=(--nogui) # These arguments are passed directly to the script file by run.sh
...runs/example.sh is a very simple script, provided as a minimal starting point for writing your own, for running a standard Minecraft server.jar.
#!/bin/bash
echo 'Launching default Minecraft server jar...'
$JVM -server @user_jvm_args -jar $EXAMPLE_SCRIPT_JARFILE "$@"...
RUN_SCRIPT=example.sh
RUN_SCRIPT_ARGS=(--nogui)
...
# runs/example.sh properties
EXAMPLE_SCRIPT_JARFILE=server.jar
...runs/
+ example.sh
server.jar
run.sh