创建 redis_chkmult.cfg 用于记录上次创建 Redis 实例
$ vim /usr/local/redis/redis_chkmult.cfg PORTS="6381" SLAVE_CHK="true" 4.5 uninit 脚本 $ vim /usr/local/redis/uninit.sh #!/bin/sh # # define restricted path PATH="/bin:/usr/bin:/sbin:/usr/sbin" # adirname - return absolute dirname of given file adirname() { odir=`pwd`; cd `dirname $1`; pwd; cd "${odir}"; } # --------- # constants # --------- MYNAM=`basename "$0"` MYDIR=`adirname "$0"` MYTMP="${MYDIR}/../tmp" MYLCK="${MYTMP}/${MYNAM}.lock" PORTS=(${1//,/ }) vi /usr/local/redis/redis_chkmult.cfg for PORT in ${PORTS[@]} do /etc/init.d/redis_${PORT} stop sudo rm -rf /etc/init.d/redis_${PORT} sudo rm -rf /usr/local/redis/redis_${PORT} sudo rm -rf /etc/redis/redis_${PORT}.conf sudo rm -rf /data/redis/logs/redis_${PORT}.* sudo rm -rf /data/redis/${PORT}.* done $ chmod +x /usr/local/redis/uninit.sh 4.5 验证 init 脚本创建一个 Redis 实例,端口为 6383
4.6 验证 uninit 脚本删除 6383 实例