mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Merge pull request #185 from IronTetsubo/pull1
Make sure a server is stopped before deleting it
This commit is contained in:
commit
1037373392
10
init/msm
10
init/msm
@ -1261,11 +1261,17 @@ server_delete() {
|
||||
manager_property USERNAME
|
||||
|
||||
if [[ -d "$SETTINGS_SERVER_STORAGE_PATH/$1" ]]; then
|
||||
printf "Are you sure you want to delete this server and its worlds (note: backups are preserved) [y/N]: "
|
||||
printf "Are you sure you want to delete server \"$1\" and its worlds? (note: backups are preserved) [y/N]: "
|
||||
|
||||
read answer
|
||||
if [[ "$answer" =~ ^(y|Y|yes)$ ]]; then
|
||||
# TODO: stop the server if running first
|
||||
server_get_id "$1"
|
||||
local existing_id="$RETURN"
|
||||
|
||||
if server_is_running "$existing_id"; then
|
||||
echo "Server \"$1\" is running."
|
||||
server_stop_now "$existing_id"
|
||||
fi
|
||||
as_user "$SETTINGS_USERNAME" "rm -rf '$SETTINGS_SERVER_STORAGE_PATH/$1'"
|
||||
echo "Server deleted."
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user