@@ -274,6 +274,10 @@ mscs_defaults() {
274274; Location of the backup log file.
275275# mscs-backup-log=/opt/mscs/backups/backup.log
276276
277+ ; Files and directories excluded from backups. Each path is relative to the
278+ ; world/<world> directory. Separate each entry with commas.
279+ # mscs-backup-excluded-files=
280+
277281; Length in days that backups survive. A value less than 1 disables backup deletion.
278282# mscs-backup-duration=15
279283
@@ -1440,6 +1444,21 @@ worldBackup() {
14401444 --exclude $WORLDS_LOCATION /$1 /query.out \
14411445 --exclude $WORLDS_LOCATION /$1 /logs/latest.log \
14421446 "
1447+ # Add all user-specified excluded files
1448+ OLD_IFS=$IFS
1449+ IFS=,
1450+ # Check for world-specific excluded files
1451+ WORLD_BACKUP_EXCLUDED_FILES=$( getMSCSValue $1 " mscs-backup-excluded-files" " $BACKUP_EXCLUDED_FILES " )
1452+ # For each comma separated value, evaluate the $WORLD_NAME variable, and add to the list of rdiff_backup excluded files
1453+ for EXCLUDED_USER_LOCATION in $WORLD_BACKUP_EXCLUDED_FILES ; do
1454+ EVALUATED_EXCLUDED_USER_LOCATION=$( echo " $EXCLUDED_USER_LOCATION " | $PERL -sne '
1455+ $_ =~ s/\$WORLD_NAME/$world_name/g;
1456+ print;
1457+ ' -- -world_name=" $1 " )
1458+ EXCLUDE_OPTION=" $EXCLUDE_OPTION --exclude $WORLDS_LOCATION /$1 /$EVALUATED_EXCLUDED_USER_LOCATION \
1459+ "
1460+ done
1461+ IFS=$OLD_IFS
14431462 # Determine if we need to exclude the mirrored symlink or not
14441463 if [ -L " $WORLDS_LOCATION /$1 /$1 " ]; then
14451464 EXCLUDE_OPTION=" $EXCLUDE_OPTION --exclude $WORLDS_LOCATION /$1 /$1 "
@@ -1975,7 +1994,7 @@ worldStatus() {
19751994 MAX=$( printf " %s" " $STATUS " | cut -f 21)
19761995 VERSION=$( printf " %s" " $STATUS " | cut -f 13)
19771996 printf " running version %s (%d of %d users online).\n" " $VERSION " $NUM $MAX
1978- printf " Port: %d.\n" $( getServerPropertiesValue " $1 " " server-port" " $DEFAULT_PORT " )
1997+ printf " Port: %d.\n" $( getServerPropertiesValue " $1 " " server-port" " $DEFAULT_PORT " )
19791998 if [ $NUM -gt 0 ]; then
19801999 PLAYERS=$( printf " %s" $( printf " %s" " $STATUS " | cut -f 30) )
19812000 COUNTER=1
@@ -1993,7 +2012,7 @@ worldStatus() {
19932012 printf " world starting up.\n"
19942013 else
19952014 printf " running.\n"
1996- fi
2015+ fi
19972016 printf " Memory used: $( getJavaMemory " $1 " | awk ' {$1=int(100 * $1/1024/1024)/100"GB";}{ print;}' ) "
19982017 printf " ($( getMSCSValue " $1 " " mscs-maximum-memory" " $DEFAULT_MAXIMUM_MEMORY " | rev | cut -c 2- | rev | awk ' {$1=int($1/1024)"GB";}{ print;}' ) allocated).\n"
19992018 printf " Process ID: %d.\n" $( getJavaPID " $1 " )
21902209# mscs-default-server-command - Default command to run for a world server.
21912210# mscs-backup-location - Location to store backup files.
21922211# mscs-backup-log - Lcation of the backup log file.
2212+ # mscs-backup-excluded-files - Comma separated list of files and directories excluded from backups.
21932213# mscs-backup-duration - Length in days that backups survive.
21942214# mscs-log-duration - Length in days that logs survive.
21952215# mscs-enable-mirror - Enable the mirror option by default for worlds (default disabled).
22092229# $INITIAL_MEMORY - The initial amount of memory for the server.
22102230# $MAXIMUM_MEMORY - The maximum amount of memory for the server.
22112231# $SERVER_LOCATION - The location of the server .jar file.
2232+ # $WORLD_NAME - The name of the world.
22122233#
22132234# The following example key/value pairs are equivalent to the default values:
22142235# mscs-location=/opt/mscs
22362257# mscs-default-server-command=$JAVA -Xms$INITIAL_MEMORY -Xmx$MAXIMUM_MEMORY -jar $SERVER_LOCATION/$SERVER_JAR $SERVER_ARGS
22372258# mscs-backup-location=/opt/mscs/backups
22382259# mscs-backup-log=/opt/mscs/backups/backup.log
2260+ # mscs-backup-excluded_files=
22392261# mscs-backup-duration=15
22402262# mscs-log-duration=15
22412263# mscs-detailed-listing=motd server-ip server-port max-players level-type online-mode
@@ -2346,6 +2368,8 @@ LOCKFILE_DURATION=$(getDefaultsValue 'mscs-lockfile-duration' '1440')
23462368BACKUP_LOCATION=$( getDefaultsValue ' mscs-backup-location' $LOCATION ' /backups' )
23472369# Location of the backup log file.
23482370BACKUP_LOG=$( getDefaultsValue ' mscs-backup-log' $BACKUP_LOCATION ' /backup.log' )
2371+ # Comma separated list of files and directories excluded from backups.
2372+ BACKUP_EXCLUDED_FILES=$( getDefaultsValue ' mscs-backup-excluded-files' ' ' )
23492373# Length in days that backups survive.
23502374BACKUP_DURATION=$( getDefaultsValue ' mscs-backup-duration' ' 15' )
23512375
0 commit comments