mdserver-web/plugins/redis/install.sh

47 lines
1011 B
Bash
Raw Normal View History

2018-11-05 06:05:33 -05:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2019-03-12 04:28:48 -04:00
install_tmp=${rootPath}/tmp/mw_install.pl
2018-11-05 06:05:33 -05:00
2020-06-07 04:29:49 -04:00
VERSION=$2
2018-11-05 06:05:33 -05:00
2018-11-05 10:42:01 -05:00
Install_redis()
2018-11-05 06:05:33 -05:00
{
echo '正在安装脚本文件...' > $install_tmp
2020-06-07 04:29:49 -04:00
mkdir -p $serverPath/source
2018-11-05 06:05:33 -05:00
2020-06-07 04:29:49 -04:00
if [ ! -f $serverPath/source/redis-${VERSION}.tar.gz ];then
wget -O $serverPath/source/redis-${VERSION}.tar.gz http://download.redis.io/releases/redis-${VERSION}.tar.gz
fi
cd $serverPath/source && tar -zxvf redis-${VERSION}.tar.gz
2018-11-20 04:43:29 -05:00
mkdir -p $serverPath/redis
2020-06-07 04:29:49 -04:00
cd redis-${VERSION} && make PREFIX=$serverPath/redis install
2018-11-20 04:43:29 -05:00
sed '/^ *#/d' redis.conf > $serverPath/redis/redis.conf
2020-06-07 04:29:49 -04:00
echo "${VERSION}" > $serverPath/redis/version.pl
2018-11-20 04:43:29 -05:00
2018-12-05 01:00:31 -05:00
echo '安装完成' > $install_tmp
2018-11-05 06:05:33 -05:00
}
2018-11-05 10:42:01 -05:00
Uninstall_redis()
2018-11-05 06:05:33 -05:00
{
2018-12-05 01:00:31 -05:00
rm -rf $serverPath/redis
echo "Uninstall_redis" > $install_tmp
2018-11-05 06:05:33 -05:00
}
action=$1
if [ "${1}" == 'install' ];then
2018-11-05 10:42:01 -05:00
Install_redis
2018-11-05 06:05:33 -05:00
else
2018-11-05 10:42:01 -05:00
Uninstall_redis
2018-11-05 06:05:33 -05:00
fi