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
|
|
|
|
2022-06-12 22:34:02 -04:00
|
|
|
VERSION=1.6.15
|
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
|
2022-07-03 10:42:29 -04:00
|
|
|
# mkdir -p $serverPath/memcached
|
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
|
2022-11-28 08:46:56 -05:00
|
|
|
wget --no-check-certificate -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-${VERSION}.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
|
|
|
|
2022-07-03 10:42:29 -04:00
|
|
|
|
2022-06-12 22:29:15 -04:00
|
|
|
echo "./configure --prefix=${serverPath}/memcached && make && make install"
|
2022-06-12 22:33:24 -04:00
|
|
|
cd $serverPath/source/memcached-${VERSION} && ./configure --prefix=$serverPath/memcached && make && make install
|
2018-11-25 03:46:23 -05:00
|
|
|
|
2022-06-28 21:05:41 -04:00
|
|
|
if [ -d $serverPath/memcached ];then
|
|
|
|
|
echo '1.6' > $serverPath/memcached/version.pl
|
|
|
|
|
echo 'install ok' > $install_tmp
|
|
|
|
|
|
|
|
|
|
cd ${rootPath} && python3 ${rootPath}/plugins/memcached/index.py start
|
|
|
|
|
cd ${rootPath} && python3 ${rootPath}/plugins/memcached/index.py initd_install
|
|
|
|
|
fi
|
2018-11-25 03:46:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Uninstall_mem()
|
|
|
|
|
{
|
2022-06-28 21:05:41 -04:00
|
|
|
|
2022-07-03 10:22:03 -04:00
|
|
|
if [ -f /usr/lib/systemd/system/memcached.service ];then
|
2022-06-28 21:05:41 -04:00
|
|
|
systemctl stop memcached
|
|
|
|
|
systemctl disable memcached
|
2022-07-03 10:22:03 -04:00
|
|
|
rm -rf /usr/lib/systemd/system/memcached.service
|
2022-06-28 21:05:41 -04:00
|
|
|
systemctl daemon-reload
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -f $serverPath/memcached/initd/memcached ];then
|
|
|
|
|
$serverPath/memcached/initd/memcached stop
|
|
|
|
|
fi
|
2019-03-15 04:45:15 -04:00
|
|
|
rm -rf $serverPath/memcached
|
2018-11-25 03:46:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-07-03 10:42:29 -04:00
|
|
|
# /www/server/memcached/bin/memcached -d -p 11211 -u root -m 100 -c 100
|
|
|
|
|
|
2018-11-25 03:46:23 -05:00
|
|
|
action=$1
|
|
|
|
|
if [ "${1}" == 'install' ];then
|
|
|
|
|
Install_mem
|
|
|
|
|
else
|
|
|
|
|
Uninstall_mem
|
|
|
|
|
fi
|