Files
percona-toolkit/sandbox/stop-sandbox
Carlos Salguero f3132d3cee WIP
2018-01-25 00:01:56 -03:00

34 lines
594 B
Bash
Executable File

#!/bin/bash
TMP_DIR=${TMP_DIR:-/tmp}
die() {
echo $1 >&2
exit 1
}
if [ $# -lt 1 ]; then
die "Usage: stop-sandbox PORTS"
fi
exit_status=0
for port in "$@"; do
if ! [ -d "${TMP_DIR}/$port" ]; then
echo "MySQL test server on port $port does not exist."
continue
fi
if [ -x "${TMP_DIR}/$port/stop" ]; then
${TMP_DIR}/$port/stop
exit_status=$((exit_status | $?))
else
echo "${TMP_DIR}/$port is missing files:" >&2
ls -la ${TMP_DIR}/$port >&2
fi
rm -rf ${TMP_DIR}/$port
exit_status=$((exit_status | $?))
done
exit $exit_status