28 lines
638 B
Bash
Executable File
28 lines
638 B
Bash
Executable File
#!/bin/bash
|
|
# Stop a running room by dispatching to its own ctrl/stop.sh in gen/.
|
|
#
|
|
# Usage:
|
|
# ./ctrl/stop.sh # standalone
|
|
# ./ctrl/stop.sh amar # a named room
|
|
#
|
|
# Mirror of ctrl/start.sh — the room's own script does the work.
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
|
|
ROOM="standalone"
|
|
if [[ $# -gt 0 && "$1" != -* ]]; then
|
|
ROOM="$1"
|
|
shift
|
|
fi
|
|
|
|
ROOM_DIR="$ROOT_DIR/gen/$ROOM"
|
|
|
|
if [[ ! -x "$ROOM_DIR/ctrl/stop.sh" ]]; then
|
|
echo "No stop script at gen/$ROOM/ctrl/stop.sh — nothing to stop." >&2
|
|
exit 0
|
|
fi
|
|
|
|
exec "$ROOM_DIR/ctrl/stop.sh" "$@"
|