You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
592 B
30 lines
592 B
5 years ago
|
#!/bin/bash
|
||
|
|
||
5 years ago
|
set -o errexit
|
||
|
|
||
5 years ago
|
# start an standalone redis with given port
|
||
|
if [ $# != 2 ] ; then
|
||
|
echo "USAGE: $0 [port] [start/stop]"
|
||
|
exit 1
|
||
|
elif [ $2 != "start" -a $2 != "stop" ]; then
|
||
|
echo "parameter illegal"
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
port=$1
|
||
|
path="standalone-$port"
|
||
|
curPath=$(cd "$(dirname "$0")"; pwd)
|
||
|
subPath="$curPath/$path"
|
||
|
|
||
|
if [ $2 == "start" ]; then
|
||
|
# start
|
||
|
mkdir -p $subPath
|
||
|
cd $subPath
|
||
|
../../tools/redis-server --port $port --pidfile $subPath/$port.pid 1>/dev/null 2>&1 &
|
||
|
else
|
||
|
# stop
|
||
|
kill -9 $(cat $subPath/$port.pid)
|
||
|
cd $curPath
|
||
|
rm -rf $subPath
|
||
|
fi
|