mdserver-web/plugins/memcached/install.sh

45 lines
960 B
Bash
Raw Normal View History

2018-11-25 03:46:23 -05:00
#!/bin/bash
2019-03-15 04:45:15 -04:00
2018-11-25 03:46:23 -05:00
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-25 03:46:23 -05:00
2019-03-15 04:45:15 -04:00
Install_mem(){
2018-12-07 02:55:12 -05:00
mkdir -p $serverPath/source
2018-11-25 03:46:23 -05:00
echo '正在安装脚本文件...' > $install_tmp
2018-12-08 22:42:11 -05:00
if [ ! -f $serverPath/source/memcached.tar.gz ];then
2021-04-23 21:19:12 -04:00
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.6.9.tar.gz
2019-03-15 04:45:15 -04:00
fi
2018-12-08 22:42:11 -05:00
2018-12-08 22:36:18 -05:00
cd $serverPath/source && tar -zxvf memcached.tar.gz
2018-11-25 03:46:23 -05:00
2018-11-25 04:48:48 -05:00
mkdir -p $serverPath/memcached
2019-03-15 04:45:15 -04:00
cd $serverPath/source/memcached*
./configure --prefix=$serverPath/memcached && make && make install
2018-11-25 03:46:23 -05:00
2021-04-23 21:19:30 -04:00
echo '1.6' > $serverPath/memcached/version.pl
2019-03-15 04:45:15 -04:00
echo 'install ok' > $install_tmp
2018-11-25 03:46:23 -05:00
}
Uninstall_mem()
{
2019-03-15 04:45:15 -04:00
${serverPath}/memcached/init.d/memcached stop
rm -rf $serverPath/memcached
2018-11-25 03:46:23 -05:00
}
action=$1
if [ "${1}" == 'install' ];then
Install_mem
else
Uninstall_mem
fi