mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Add lib/, t/lib/, and sandbox/. All modules are updated and passing on MySQL 5.1.
This commit is contained in:
60
sandbox/stop-sandbox
Executable file
60
sandbox/stop-sandbox
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
err() {
|
||||
echo
|
||||
for msg; do
|
||||
echo $msg
|
||||
done
|
||||
echo "See http://code.google.com/p/maatkit/wiki/Testing for more information."
|
||||
echo
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# Sanity check the cmd line options.
|
||||
# ###########################################################################
|
||||
if [ $# -lt 1 ]; then
|
||||
err "Usage: stop-sandbox [remove] all|port [port...]" \
|
||||
"The 'all' option stops sandboxes /tmp/123[0-9]*." \
|
||||
"The sandbox directories are removed if the first option is 'remove'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ###########################################################################
|
||||
# Stop the sandboxes.
|
||||
# ###########################################################################
|
||||
|
||||
exit_status=0
|
||||
|
||||
for port in $@; do
|
||||
if [ "$port" = "remove" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$port" = "all" ]; then
|
||||
ls /tmp/1234* >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
for a in /tmp/123[0-9]*; do
|
||||
$a/stop
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
fi
|
||||
if [ $1 = "remove" ]; then
|
||||
rm -rf $a
|
||||
fi
|
||||
done
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "/tmp/$port" ]; then
|
||||
/tmp/$port/stop
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
fi
|
||||
if [ $1 = "remove" ]; then
|
||||
rm -rf /tmp/$port
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit $exit_status
|
Reference in New Issue
Block a user