1
0
mirror of https://github.com/msmhq/msm.git synced 2024-08-30 18:12:35 +00:00

Merge branch 'master' into install_stable_vanilla

This commit is contained in:
Blaine Motsinger 2015-07-14 13:27:56 +00:00
commit fa9736b247
9 changed files with 246 additions and 56 deletions

@ -1,4 +1,9 @@
# Minecraft Server Manager [![Build Status](https://secure.travis-ci.org/marcuswhybrow/minecraft-server-manager.png?branch=master)](http://travis-ci.org/marcuswhybrow/minecraft-server-manager) [![Donate to MSM](https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z7XQDNF7U5GLL)
# Minecraft Server Manager [![Build Status][status-img]][status] [![Donate to MSM][donate-img]][donate]
[status-img]: https://api.travis-ci.org/msmhq/msm.png?branch=master
[status]: http://travis-ci.org/msmhq/msm
[donate-img]: https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif
[donate]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z7XQDNF7U5GLL
A single init script which makes running multiple Minecraft/Bukkit servers easier for us admins.

139
init/msm

@ -23,7 +23,7 @@
# See http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit for
# more information on debain init.d scripts, which may help you understand
# more information on debian init.d scripts, which may help you understand
# this script.
@ -129,7 +129,7 @@ msm_success() {
echo -e "${COLOUR_CYAN}[MSM: ${1}]${COLOUR_RESET}"
}
# Echos the first non-empty string in the arguments list
# Echoes the first non-empty string in the arguments list
# $1->: Candidate strings for echoing
echo_fallback() {
for arg in "$@"; do
@ -195,7 +195,7 @@ to_global_name() {
}
# Converts a global BASH variable name to a server.properties file
# varibale name.
# variable name.
# $1: The string to convert
# RETURN: The name in lowercase and with dashes
to_properties_name() {
@ -252,7 +252,7 @@ is_valid_name() {
return 0
fi
else
error_exit INVALID_ARGUMENT "Invalid name \"$1\": A name may only contain letters, numbers, dashes and unscores."
error_exit INVALID_ARGUMENT "Invalid name \"$1\": A name may only contain letters, numbers, dashes and underscores."
fi
}
@ -337,7 +337,7 @@ world_to_disk() {
as_user "${SERVER_USERNAME[${WORLD_SERVER_ID[$1]}]}" "rsync -rt --exclude '$(basename "${WORLD_FLAG_INRAM[$1]}")' \"${WORLD_RAMDISK_PATH[$1]}/\" \"${WORLD_PATH[$1]}\""
}
# Toggles a worlds ramdisk state
# Toggles a worlds ram disk state
# $1: The ID of the world
world_toggle_ramdisk_state() {
world_property "$1" FLAG_INRAM
@ -373,20 +373,41 @@ world_toggle_ramdisk_state() {
# Backs up a world
# $1: The ID of the world
world_backup() {
world_property "$1" PATH
world_property "$1" BACKUP_PATH
echo -n "Backing up world \"${WORLD_NAME[$1]}\"... "
file_name="$(date "+%F-%H-%M-%S").zip"
manager_property WORLD_ARCHIVE_ENABLED
manager_property RDIFF_BACKUP_ENABLED
manager_property RSYNC_BACKUP_ENABLED
local server_id="${WORLD_SERVER_ID[$1]}"
local containing_dir="$(dirname "${WORLD_PATH[$1]}")"
local dir_name="$(basename "${WORLD_PATH[$1]}")"
world_property "$1" PATH
world_property "$1" BACKUP_PATH
server_property "$server_id" USERNAME
as_user "${SERVER_USERNAME[$server_id]}" "mkdir -p \"${WORLD_BACKUP_PATH[$1]}\" && cd \"$containing_dir\" && zip -rq \"${WORLD_BACKUP_PATH[$1]}/${file_name}\" \"${dir_name}\""
echo -n "Entering in backup function ... "
echo "Done."
if [[ "$SETTINGS_WORLD_ARCHIVE_ENABLED" == "true" ]]; then
echo -n "Backing up world \"${WORLD_NAME[$1]}\"... "
file_name="$(date "+%F-%H-%M-%S").zip"
server_property "$server_id" USERNAME
as_user "${SERVER_USERNAME[$server_id]}" "mkdir -p \"${WORLD_BACKUP_PATH[$1]}\" && cd \"$containing_dir\" && zip -rq \"${WORLD_BACKUP_PATH[$1]}/${file_name}\" \"${dir_name}\""
echo "Done."
fi
if [[ "$SETTINGS_RDIFF_BACKUP_ENABLED" == "true" ]]; then
echo -n "rdiff-backup world \"${WORLD_NAME[$1]}\"... "
server_property "$server_id" USERNAME
as_user "${SERVER_USERNAME[$server_id]}" "mkdir -p \"${RDIFF_BACKUP_PATH[$1]}\" && cd \"$containing_dir\" && nice -n \"$SETTINGS_RDIFF_BACKUP_NICE\" rdiff-backup \"${dir_name}\" \"${RDIFF_BACKUP_PATH[$1]}\" && nice -n \"$SETTINGS_RDIFF_BACKUP_NICE\" rdiff-backup --remove-older-than \"$SETTINGS_RDIFF_BACKUP_ROTATION\"D --force \"${RDIFF_BACKUP_PATH[$1]}\""
echo "Done."
fi
if [[ "$SETTINGS_RSYNC_BACKUP_ENABLED" == "true" ]]; then
echo -n "rsync-backup world \"${WORLD_NAME[$1]}\"... "
file_name="$(date "+%F-%H-%M-%S")"
server_property "$server_id" USERNAME
as_user "${SERVER_USERNAME[$server_id]}" "mkdir -p \"${RSYNC_BACKUP_PATH[$1]}\" && cd \"$containing_dir\" && rsync -aH --link-dest=\"${RSYNC_BACKUP_PATH[$1]}/latest\" \"${dir_name}\" \"${RSYNC_BACKUP_PATH[$1]}/${file_name}\" && rm -f \"${RSYNC_BACKUP_PATH[$1]}/latest\" && ln -s \"${file_name}\" \"${RSYNC_BACKUP_PATH[$1]}/latest\""
echo "Done."
fi
}
# Activates a world
@ -409,6 +430,10 @@ world_activate() {
error_exit DIR_NOT_FOUND "Directory \"${WORLD_INACTIVE_PATH[$1]}\" could not be found."
fi
fi
}
# Deactivates a world
@ -486,11 +511,15 @@ world_property() {
;;
BACKUP_PATH)
manager_property WORLD_ARCHIVE_PATH
manager_property WORLD_RDIFF_PATH
manager_property WORLD_RSYNC_PATH
WORLD_BACKUP_PATH[$1]="$SETTINGS_WORLD_ARCHIVE_PATH/${SERVER_NAME[$sid]}/${WORLD_NAME[$1]}"
RDIFF_BACKUP_PATH[$1]="$SETTINGS_WORLD_RDIFF_PATH/${SERVER_NAME[$sid]}/${WORLD_NAME[$1]}"
RSYNC_BACKUP_PATH[$1]="$SETTINGS_WORLD_RSYNC_PATH/${SERVER_NAME[$sid]}/${WORLD_NAME[$1]}"
;;
RAMDISK_PATH)
manager_property RAMDISK_STORAGE_ENABLED
# If the ramdisk path is set, get the path for this world
# If the ram disk path is set, get the path for this world
if [[ "$SETTINGS_RAMDISK_STORAGE_ENABLED" == "true" ]]; then
manager_property RAMDISK_STORAGE_PATH
WORLD_RAMDISK_PATH[$1]="${SETTINGS_RAMDISK_STORAGE_PATH}/${SERVER_NAME[$sid]}/${WORLD_NAME[$1]}"
@ -529,6 +558,8 @@ world_dirty_properties() {
unset WORLD_FLAG_INRAM$index
unset WORLD_LINK$index
unset WORLD_BACKUP_PATH$index
unset RDIFF_BACKUP_PATH$index
unset RSYNC_BACKUP_PATH$index
unset WORLD_RAMDISK_PATH$index
unset WORLD_INRAM$index
}
@ -618,7 +649,7 @@ server_ensure_jar() {
# $2: The setting name to read
server_read_config() {
unset RETURN
# Convert name into upper-case with underscores
# Convert name into uppercase with underscores
# msm-setting => SERVER_SETTING
# setting => SERVER_PROPERTIES_SETTING
if [[ "$2" =~ ^msm\-(.*)$ ]]; then
@ -635,7 +666,7 @@ server_read_config() {
}
# Creates symbolic links in the server directory (SETTINGS_SERVER_STORAGE_PATH) for each
# of the Minecraft worlds located in the world storage directory.
# of the Minecraft worlds located in the worldstorage directory.
# $1: The id of the server for which links should be ensured
server_ensure_links() {
server_property "$1" USERNAME
@ -669,7 +700,7 @@ server_ensure_links() {
# ! -a, since it is within double square brackets means: the negation of
# the existence of the file. In other words: true if does not exist
if [[ -L "${WORLD_LINK[$i]}" || ! -a "${WORLD_LINK[$i]}" ]]; then
# If there is a symbolic link in the server direcotry to this world,
# If there is a symbolic link in the server directory to this world,
# or there is not a directory in the server directory containing this world.
# Get the original file path the symbolic link is pointing to
@ -723,7 +754,7 @@ server_ensure_links() {
server_worlds_to_ram() {
manager_property RAMDISK_STORAGE_ENABLED
# Only proceed if there is a ramdisk path set in config
# Only proceed if there is a ram disk path set in config
if [[ "$SETTINGS_RAMDISK_STORAGE_ENABLED" == "true" ]]; then
echo -n "Synchronising flagged worlds on disk to RAM... "
local i="${SERVER_WORLD_OFFSET[$1]}"
@ -801,7 +832,7 @@ server_log_get_line() {
}
# The same as server_log_get_line, but prints a dot instead of the log line
# to stdout, and retruns when line is found.
# to stdout, and returns when line is found.
# $1: the ID of the server
# $2: A UNIX timestamp (seconds since 1970) which the $3 line must be after
# $3: The regex that matches log lines
@ -922,7 +953,7 @@ server_pid() {
}
# Waits for a server to stop by polling 10 times a second
# This approach is fairyl intensive, so only use when you are expecting the
# This approach is fairly intensive, so only use when you are expecting the
# server to stop soon
# $1: The ID of the server to wait for
server_wait_for_stop() {
@ -1122,7 +1153,7 @@ jargroup_getlatest() {
echo "Saved as \"$SETTINGS_JAR_STORAGE_PATH/$1/$new_name\"."
fi
else
echo "Existing version \"$SETTINGS_JAR_STORAGE_PATH/$1/$new_name\" was already up to date."
echo "Existing version \"$most_recent_jar\" was already up to date."
fi
elif [[ "$num_files" == 0 ]]; then
@ -1206,7 +1237,7 @@ jargroup_rename() {
### Server Functions
### ----------------
# Echos a list of servers in the SETTINGS_SERVER_STORAGE_PATH
# Echoes a list of servers in the SETTINGS_SERVER_STORAGE_PATH
server_list() {
if [ "$NUM_SERVERS" -gt 0 ]; then
for ((server=0; server<$NUM_SERVERS; server++)); do
@ -1283,7 +1314,7 @@ server_create() {
SERVER_CONF[$NUM_SERVERS]="$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_SERVER_PROPERTIES"
NUM_SERVERS=$(($NUM_SERVERS+1))
# TODO: Dirty all server varibales, or don't allow further in script access
# TODO: Dirty all server variables, or don't allow further in script access
# TODO: Handle server default setup stuff better than just using
# the "minecraft" jar group. And make it configurable.
@ -1411,7 +1442,7 @@ server_save_off() {
server_command "$1" SAVE_OFF
echo "Done."
# Writes any in-memory data manged by the kernel to disk
# Writes any in-memory data managed by the kernel to disk
sync
else
echo "Server \"${SERVER_NAME[$1]}\" is not running."
@ -1531,7 +1562,7 @@ server_restart_now() {
# $1: The ID of the server
server_worlds_list() {
if [[ "${SERVER_NUM_WORLDS[$1]}" -eq 0 ]]; then
echo "There are no worlds in world storage."
echo "There are no worlds in worldstorage."
return 0
fi
@ -1580,7 +1611,7 @@ server_log_roll() {
local log_lines="$(cat "${SERVER_LOG_PATH[$1]}" | wc -l )"
if [ "$log_lines" -le '1' ]; then
echo "No new log enteries to roll. No change made."
echo "No new log entries to roll. No change made."
return 0
fi
@ -1792,7 +1823,7 @@ server_property() {
eval SERVER_$2[$1]=\"${SERVER_PATH[$1]}/\${SERVER_$2[$1]}\"
fi
# Replace any placeholders in a property we just loaded
# Replace any place holders in a property we just loaded
case "$2" in
SCREEN_NAME)
server_set_property "$1" "$2" "${SERVER_SCREEN_NAME[$1]//\{SERVER_NAME\}/${SERVER_NAME[$1]}}"
@ -2162,7 +2193,7 @@ command_update() {
fi
}
# Download the latest MSM script and check its verison number
# Download the latest MSM script and check its version number
download_file "init/msm"
local latest_version="$(sed -rn "s/^VERSION=('|\"|)(.*)\1/\2/ip" "${output_dir}/init/msm" | tail -n 1)"
@ -2383,7 +2414,7 @@ command_update() {
cleanup
# This script will now be replaced. So run the new script's
# update code, incase there are new things to update that
# update code, in case there are new things to update that
# this version of MSM does not know about yet.
if [[ "$any_files_updated" == "true" ]]; then
$0 update
@ -2463,7 +2494,7 @@ command_help() {
echo -e " server delete <name> Deletes an existing Minecraft server"
echo -e " server rename <name> <new-name> Renames an existing Minecraft server"
echo -e
echo -e "--Server Mangement Commands-------------------------------------"
echo -e "--Server Management Commands------------------------------------"
echo -e " <server> start Starts a server"
echo -e " <server> stop [now] Stops a server after warning players, or right now"
echo -e " <server> restart [now] Restarts a server after warning players, or right now"
@ -2583,7 +2614,7 @@ command_server_worlds_load() {
server_ensure_links "$1"
}
# Toggles a world's inram status
# Toggles a world's in ram status
# $1: The server ID
# $2: The world ID
command_server_worlds_ram() {
@ -2594,7 +2625,7 @@ command_server_worlds_ram() {
fi
}
# Synchronises all inram worlds back to disk for an individual server
# Synchronises all in ram worlds back to disk for an individual server
# $1: The server ID
command_server_worlds_todisk() {
if server_is_running "$1"; then
@ -2991,7 +3022,7 @@ command_server_kick() {
# Broadcasts a message to all connected players for a server
# $1: The server ID
# $2->: Words of the message, will be concatinated with spaces
# $2->: Words of the message, will be concatenated with spaces
command_server_say() {
if server_is_running "$1"; then
server_command "$1" SAY message="${*:2}"
@ -3086,7 +3117,7 @@ command_server_save_all() {
# Sends a command string to the server to be executed
# $1: The server ID
# $2->: A command, separate arguments are concatinated with spaces
# $2->: A command, separate arguments are concatenated with spaces
command_server_cmd() {
if server_is_running "$1"; then
server_eval "$1" "${*:2}"
@ -3099,7 +3130,7 @@ command_server_cmd() {
# Sends a command string to the server to be executed, and then tails the
# server logs to watch fro results.
# $1: The server ID
# $2->: A command, separate arguments are concatinated with spaces
# $2->: A command, separate arguments are concatenated with spaces
command_server_cmdlog() {
if server_is_running "$1"; then
server_property "$1" LOG_PATH
@ -3127,7 +3158,7 @@ command_server_console() {
}
# Sets a parameter in the config file if it exists, otherwise inserts the
# paramerter.
# parameter.
# $1: The server ID
# $2: Optionally, a setting name
# $3: Optionally, a value to set for $2
@ -3156,7 +3187,7 @@ command_server_config() {
echo "$RETURN"
fi
# If no paramter name is given
# If no parameter name is given
if [ -z "$2" ]; then
# List all parameters
for ((i=0; i<$SERVER_SETTING_COUNT; i++)); do
@ -3216,12 +3247,22 @@ register_settings() {
register_setting RAMDISK_STORAGE_ENABLED "true"
register_setting RAMDISK_STORAGE_PATH "/dev/shm/msm"
register_setting WORLD_ARCHIVE_ENABLED "true"
register_setting WORLD_RDIFF_PATH "/opt/msm/rdiff-backup/worlds"
register_setting RDIFF_BACKUP_ENABLED "false"
register_setting RDIFF_BACKUP_NICE "19"
register_setting RDIFF_BACKUP_ROTATION "7"
register_setting UPDATE_URL "https://raw.github.com/marcuswhybrow/minecraft-server-manager/latest"
register_setting WORLD_ARCHIVE_PATH "/opt/msm/archives/worlds"
register_setting LOG_ARCHIVE_PATH "/opt/msm/archives/logs"
register_setting BACKUP_ARCHIVE_PATH "/opt/msm/archives/backups"
register_setting RSYNC_BACKUP_ENABLED "false"
register_setting WORLD_RSYNC_PATH "/opt/msm/rsync/worlds"
register_setting JARGROUP_TARGET "target.txt"
register_setting JARGROUP_DOWNLOAD_DIR "downloads"
register_setting SERVER_PROPERTIES "server.properties"
@ -3280,7 +3321,7 @@ register_settings() {
# $2: The handler function to call, if this command is identified.
register_command() {
# Here we build a regular expression which will match any user input
# that could be passed to the given handler function. It is derrived
# that could be passed to the given handler function. It is derived
# automatically from the given command signature.
local regex="^"
@ -3321,7 +3362,7 @@ register_command() {
if [ ${#regex} -ge 1 ]; then
regex="${regex:0:${#regex}-1}\$"
# Sets the global command varibales in order to register this command
# Sets the global command variables in order to register this command
COMMAND_SIGNATURE[$COMMAND_COUNT]="$1"
COMMAND_REGEX[$COMMAND_COUNT]="$regex"
COMMAND_HANDLER[$COMMAND_COUNT]="$2"
@ -3376,7 +3417,7 @@ call_command() {
# given to the script, to the handler (which may contain constant
# strings), it only includes variables.
for word in ${COMMAND_SIGNATURE[$command]}; do
# Whether a positional argument is a varibale or not is
# Whether a positional argument is a variable or not is
# determined by the respective element in the command signature
# given when registering.
#
@ -3393,7 +3434,7 @@ call_command() {
# The "<strings>" token must only be placed at the end of a
# commadn signature, and allows an arbitrary amount of
# command signature, and allows an arbitrary amount of
# arguments to be passed to the command handler function.
"<strings>")
# Put all remaining user input onto the argument stack
@ -3521,7 +3562,7 @@ call_command() {
# all possible worlds.
if [[ "$sid" == "server:all" ]] && [[ "$wid" == "world:all" ]]; then
for ((j=0; j<$NUM_WORLDS; j++)); do
# Replace server and world id placeholders with actual id's
# Replace server and world id place holders with actual id's
local replaced_args
for k in ${!args[@]}; do
replaced_args[$k]="${args[$k]//server:all/${WORLD_SERVER_ID[$j]}}"
@ -3610,7 +3651,7 @@ register_commands() {
# included after a "<name:server>" element.
#
# Elements listed above encapsulated within angle brackets must be included
# within a signature verbatim, as apposed to the "fixedstring" element
# within a signature verbatim, as opposed to the "fixedstring" element
# which is arbitrary.
#
# Variables passed to handler functions are of course positional and there
@ -3762,17 +3803,17 @@ server_worlds_allocate() {
done < <(find "${SERVER_WORLD_STORAGE_INACTIVE_PATH[$1]}" -mindepth 1 -maxdepth 1 -type d -print0)
fi
# Record the number fo worlds this server has
# Record the number of worlds this server has
SERVER_NUM_WORLDS[$1]="$(( $NUM_WORLDS - ${SERVER_WORLD_OFFSET[$1]} ))"
}
# Allocates stub varibales, in this context a stub is
# Allocates stub variables, in this context a stub is
# enough data to be able to load in more data via
# the *_property functions.
allocate() {
manager_property SERVER_STORAGE_PATH
# Dermine server names (but don't load them)
# Determine server names (but don't load them)
if [ -d "$SETTINGS_SERVER_STORAGE_PATH" ]; then
while IFS= read -r -d $'\0' path; do
server_allocate "$path"
@ -3851,7 +3892,7 @@ _newest_version() {
# Checks available versions MSM supports and returns the
# closes match.
# $1: Version name prefered
# $1: Version name preferred
# $RETURN: The closest available version, older or equal
# to the given version $1
get_closest_version() {
@ -3971,7 +4012,7 @@ console_event() {
# must be set before calling this function
# $1: The name of the command
# $2: The command pattern
# $3->: The log lines ot accept as confirmation
# $3->: The log lines to accept as confirmation
console_command() {
local command_name command_timeout
if [[ "$1" =~ (.*):(.*) ]]; then

15
init/msm.service Normal file

@ -0,0 +1,15 @@
[Unit]
Description=Minecraft Server Manager
Requires=network.target
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/msm start
ExecStop=/usr/local/bin/msm stop
ExecReload=/usr/local/bin/msm restart
[Install]
WantedBy=multi-user.target

37
installers/arch.sh Executable file

@ -0,0 +1,37 @@
UPDATE_URL="https://raw.github.com/marcuswhybrow/minecraft-server-manager/master"
curl -L "${UPDATE_URL}/installers/common.sh" -o /tmp/msmcommon.sh #wget isn't installed on Arch by default
source /tmp/msmcommon.sh && rm -f /tmp/msmcommon.sh
function update_system_packages() {
install_log "Updating sources"
sudo pacman -Syy || install_error "Couldn't update packages"
}
function install_dependencies() {
install_log "Installing required packages"
sudo pacman --noconfirm -S screen rsync zip wget || install_error "Couldn't install dependencies"
}
function enable_init() {
install_log "Installing systemd service unit"
sudo wget ${UPDATE_URL}/init/msm.service \
-O /etc/systemd/system/msm.service
install_log "Enabling automatic startup and shutdown"
sudo systemctl enable msm.service
}
# Verifies existence and permissions of msm server directory (default /opt/msm)
function create_msm_directories() {
install_log "Creating MSM directories"
if [ ! -d "$msm_dir" ]; then
sudo mkdir -p "$msm_dir" || install_error "Couldn't create directory '$msm_dir'"
fi
sudo chown -R $msm_user:$msm_user "$msm_dir" || install_error "Couldn't change file ownership for '$msm_dir'"
if [ ! -d "/etc/init.d" ]; then
sudo mkdir -p "/etc/init.d/" || install_error "Couldn't create directory '/etc/init.d'"
fi
}
install_msm

@ -1,5 +1,6 @@
msm_dir="/opt/msm"
msm_user="minecraft"
msm_user_system=false
dl_dir="$(mktemp -d -t msm-XXX)"
# Outputs an MSM INSTALL log line
@ -30,9 +31,14 @@ function config_installation() {
msm_user="$input"
fi
echo -n "Add new user as system account? [y/N]: "
read answer
if [[ $answer != "y" ]]; then
msm_user_system=true
fi
echo -n "Complete installation with these values? [y/N]: "
read answer
if [[ $answer != "y" ]]; then
echo "Installation aborted."
exit 0
@ -54,8 +60,11 @@ function install_dependencies() {
# Verifies existence of or adds user for Minecraft server (default "minecraft")
function add_minecraft_user() {
install_log "Creating default user '${msm_user}'"
sudo useradd ${msm_user} \
--home /opt/msm
if $msm_user_system; then
sudo useradd ${msm_user} --home "$msm_dir"
else
sudo useradd ${msm_user} --system --home "$msm_dir"
fi
}
# Verifies existence and permissions of msm server directory (default /opt/msm)
@ -117,6 +126,7 @@ function install_config() {
function install_cron() {
install_log "Installing MSM cron file"
sudo install -m0644 "$dl_dir/msm.cron" /etc/cron.d/msm || install_error "Couldn't install cron file"
sudo /etc/init.d/cron reload
}
# Installs init script into /etc/init.d

37
installers/install.sh Normal file

@ -0,0 +1,37 @@
BASE_URL="https://raw.github.com/marcuswhybrow/minecraft-server-manager/master/installers/"
function check_os() {
if [[ -f /etc/debian_version ]]; then
INSTALL_SCRIPT="debian.sh"
elif [[ -f /etc/redhat-release ]]; then
INSTALL_SCRIPT="redhat.sh"
elif [[ -f /etc/arch-release ]]; then
INSTALL_SCRIPT="arch.sh"
else
echo "Error, unsupported distribution. Please install manually."
exit 1
fi
}
function get_installer() {
type curl 1>/dev/null 2>&1
if [[ $? -eq 0 ]]; then
curl -L "${BASE_URL}/${INSTALL_SCRIPT}" -o /tmp/msminst.sh
else
wget -q "${BASE_URL}/${INSTALL_SCRIPT}" -O /tmp/msminst.sh
fi
chmod u+x /tmp/msminst.sh
}
function do_install() {
if [[ -f /tmp/msminst.sh ]]; then
/tmp/msminst.sh && rm -f /tmp/msminst.sh
else
echo "Error, failed to download install script."
exit 1
fi
}
check_os
get_installer
do_install

@ -4,12 +4,12 @@ source /tmp/msmcommon.sh && rm -f /tmp/msmcommon.sh
function update_system_packages() {
install_log "Updating sources"
sudo yum update || install_error "Couldn't update packages"
sudo yum update --skip-broken || install_error "Couldn't update packages"
}
function install_dependencies() {
install_log "Installing required packages"
sudo yum install screen rsync zip || install_error "Couldn't install dependencies"
sudo yum install screen rsync zip java || install_error "Couldn't install dependencies"
}
function enable_init() {

@ -39,6 +39,9 @@ RAMDISK_STORAGE_ENABLED="true"
RAMDISK_STORAGE_PATH="/dev/shm/msm"
# Backup Options
# -------------------
# Quick IMPORTANT note:
# The following three paths are used to store backups of your servers which
# MSM creates periodically. Backups are useful if a world becomes unplayable
@ -50,6 +53,8 @@ RAMDISK_STORAGE_PATH="/dev/shm/msm"
# separate disk. This can be achieved by mounting an external hard drive, or
# a NAS and locating the following paths there.
# Did zip backup enabled ?
WORLD_ARCHIVE_ENABLED="true"
# Where "WorldEdit snapshot" compatible world backups are stored.
WORLD_ARCHIVE_PATH="/opt/msm/archives/worlds"
@ -60,6 +65,38 @@ LOG_ARCHIVE_PATH="/opt/msm/archives/logs"
# Where complete server backups are stored:
BACKUP_ARCHIVE_PATH="/opt/msm/archives/backups"
# rdiff-backup for worlds note:
# If you want to use rdiff-backup as backup system for your worlds you need to have
# it installed on your server.
# You can enable it and set number of days to keep versions in RDIFF_BACKUP_ROTATION.
# The RDIFF_BACKUP_NICE indice is the priority when the task is launched: -20 is
# the higher priority, let to default (19) as a less priority is probably what you need.
# Did rdiff-backup enabled ?
RDIFF_BACKUP_ENABLED="false"
# Number of days to keep versions
RDIFF_BACKUP_ROTATION="7"
# The nice parameter "-20" to "19", -20 is the higher priority on the system, 19 is the lessest
RDIFF_BACKUP_NICE="19"
# Where "rdiff-backup" world backups are stored.
WORLD_RDIFF_PATH="/opt/msm/rdiff-backup/worlds"
# rsync backup note:
# rsync backups are simple copies of your world data. They are similar to the default
# zip backups but are not placed in .zip files. They are uncompressed, but files that
# are unchanged between backups will be hardlinked so they occupy no additional space.
# Compared to rdiff-backups, they will usually take up more space, but they are
# "WorldEdit snapshot" compatible like zip backups.
# If you want to use rsync for backups you need to have it installed on your server.
# Are rsync backups enabled ?
RSYNC_BACKUP_ENABLED="false"
# Where "rsync" world backups are stored.
WORLD_RSYNC_PATH="/opt/msm/rsync/worlds"
# Server Defaults

10
test.sh Normal file → Executable file

@ -570,4 +570,12 @@ test_listing_multiple_jargroups() {
# Perform tests
source shunit2
# local copy of shunit2
source shunit2 2>/dev/null
if [ $? -ne 0 ]; then
# default install location for shunit2
source "/usr/share/shunit2/shunit2" 2>/dev/null
if [ $? -ne 0 ]; then
echo "Could not find shUnit2 install."
fi
fi