Added server "save" commands. Closes #7.

This commit is contained in:
Marcus Whybrow 2012-05-31 00:49:51 +01:00
parent 072184e9bb
commit e994e5c496

26
msm
View File

@ -730,7 +730,7 @@ server_save_all() {
echo "Done." echo "Done."
else else
echo "Server \"${server_name[$1]}\" was not running." echo "Server \"${server_name[$1]}\" is not running."
fi fi
} }
@ -748,7 +748,7 @@ server_save_off() {
# Writes any in-memory data manged by the kernel to disk # Writes any in-memory data manged by the kernel to disk
sync sync
else else
echo "Server \"${server_name[$1]}\" was not running." echo "Server \"${server_name[$1]}\" is not running."
fi fi
} }
@ -763,7 +763,7 @@ server_save_on() {
echo "Done." echo "Done."
else else
echo "Server \"${server_name[$1]}\" was not running." echo "Server \"${server_name[$1]}\" is not running."
fi fi
} }
@ -792,7 +792,7 @@ server_stop() {
server_stop_now $1 server_stop_now $1
else else
echo "Server \"${server_name[$1]}\" was not running." echo "Server \"${server_name[$1]}\" is not running."
fi fi
} }
@ -814,7 +814,7 @@ server_stop_now() {
# Synchronise all worlds in RAM to disk # Synchronise all worlds in RAM to disk
server_worlds_to_disk $1 server_worlds_to_disk $1
else else
echo "Server \"${server_name[$1]}\" was not running." echo "Server \"${server_name[$1]}\" is not running."
fi fi
} }
@ -948,7 +948,7 @@ server_connected() {
echo "$players" echo "$players"
fi fi
else else
echo "Server \"${server_name[$id]}\" is stopped. No users are connected." echo "Server \"${server_name[$id]}\" is not running. No users are connected."
fi fi
} }
@ -1953,6 +1953,20 @@ main() {
fi fi
;; ;;
save) save)
case "$3" in
on)
server_save_on $id
;;
off)
server_save_off $id
;;
all)
server_save_all $id
;;
*)
echo "Invalid command."
;;
esac
;; ;;
cmd) cmd)
if [ -z "$3" ]; then if [ -z "$3" ]; then