support for multiple instances of minecraft in restic minecraft hook
This commit is contained in:
parent
5b65beff27
commit
11898e4ee7
@ -85,23 +85,30 @@ open_files() {
|
|||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
prereq "$SERVICE"
|
|
||||||
|
|
||||||
if [ "$1" == "pre" ]; then
|
if [ "$1" == "pre" ]; then
|
||||||
printf "stopping %s\n" $SERVICE
|
for path in "$VAR_DIR"/*; do
|
||||||
if ! stop_server $SERVICE; then
|
instance="minecraft@$(basename "$path").service"
|
||||||
error_exit "Failed to stop $SERVICE"
|
prereq "$instance"
|
||||||
fi
|
printf "stopping %s\n" "$instance"
|
||||||
|
if ! stop_server "$instance"; then
|
||||||
|
error_exit "Failed to stop $instance"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
printf "checking for open files\n"
|
printf "checking for open files\n"
|
||||||
if ! open_files $VAR_DIR; then
|
if ! open_files $VAR_DIR; then
|
||||||
error_exit "Open files exist in $VAR_DIR"
|
error_exit "Open files exist in $VAR_DIR"
|
||||||
fi
|
fi
|
||||||
elif [ "$1" == "post" ]; then
|
elif [ "$1" == "post" ]; then
|
||||||
printf "starting %s\n" $SERVICE
|
for path in "$VAR_DIR"/*; do
|
||||||
if ! start_server $SERVICE; then
|
instance="minecraft@$(basename "$path").service"
|
||||||
error_exit "Failed to start $SERVICE"
|
prereq "$instance"
|
||||||
fi
|
printf "starting %s\n" "$instance"
|
||||||
|
if ! start_server "$instance"; then
|
||||||
|
error_exit "Failed to start $instance"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user