Simple Linux Panel
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.
mdserver-web/plugins/redis/install.sh

77 lines
1.7 KiB

7 years ago
#!/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")
6 years ago
install_tmp=${rootPath}/tmp/mw_install.pl
7 years ago
5 years ago
VERSION=$2
7 years ago
2 years ago
Install_App()
7 years ago
{
echo '正在安装脚本文件...' > $install_tmp
5 years ago
mkdir -p $serverPath/source
7 years ago
5 years ago
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
7 years ago
mkdir -p $serverPath/redis
mkdir -p $serverPath/redis/data
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
cd redis-${VERSION} && gmake PREFIX=$serverPath/redis install
else
cd redis-${VERSION} && make PREFIX=$serverPath/redis install
fi
7 years ago
sed '/^ *#/d' redis.conf > $serverPath/redis/redis.conf
if [ -d $serverPath/redis ];then
echo "${VERSION}" > $serverPath/redis/version.pl
echo '安装完成' > $install_tmp
7 years ago
cd ${rootPath} && python3 ${rootPath}/plugins/redis/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/redis/index.py initd_install
fi
7 years ago
}
2 years ago
Uninstall_App()
7 years ago
{
if [ -f /usr/lib/systemd/system/redis.service ];then
systemctl stop redis
systemctl disable redis
rm -rf /usr/lib/systemd/system/redis.service
systemctl daemon-reload
fi
if [ -f /lib/systemd/system/redis.service ];then
systemctl stop redis
systemctl disable redis
rm -rf /lib/systemd/system/redis.service
systemctl daemon-reload
fi
if [ -f $serverPath/redis/initd/redis ];then
$serverPath/redis/initd/redis stop
fi
rm -rf $serverPath/redis
7 years ago
echo "Uninstall_redis" > $install_tmp
7 years ago
}
action=$1
if [ "${1}" == 'install' ];then
2 years ago
Install_App
7 years ago
else
2 years ago
Uninstall_App
7 years ago
fi