Files
download/memcached/update.sh
耗子 758e1c8799
All checks were successful
Generate Checksums / checksums (push) Successful in 46s
feat: 清理提交
2026-01-31 07:03:45 +08:00

65 lines
1.5 KiB
Bash

#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
if [ $? -ne 0 ]; then
echo "Download public.sh failed, please check the network or try again later."
exit 1
fi
channel=${1}
version=${2}
memcached_path="${setup_path}/server/memcached"
# 预检查
systemctl is-active --quiet memcached
if [ "$?" != "0" ]; then
error "Application is not running properly"
fi
rm -rf ${memcached_path}
mkdir -p ${memcached_path}
cd ${memcached_path}
# 下载源码
dl "${memcached_path}" "/memcached/memcached-${version}.tar.gz"
tar -zxvf memcached-${version}.tar.gz
rm -f memcached-${version}.tar.gz
mv memcached-${version} src
cd src
chmod +x configure
./configure --prefix=${memcached_path} --enable-tls --enable-sasl --enable-sasl-pwdb --enable-64bit
if [ "$?" != "0" ]; then
rm -rf ${memcached_path}
error "Configuration failed"
fi
make -j${CORES}
if [ "$?" != "0" ]; then
rm -rf ${memcached_path}
error "Compilation failed"
fi
# 停止已有服务
systemctl stop memcached
make install
if [ ! -f "${memcached_path}/bin/memcached" ]; then
rm -rf ${memcached_path}
error "Installation failed"
fi
chown -R memcached:memcached ${memcached_path}
chmod -R 700 ${memcached_path}
systemctl daemon-reload
systemctl start memcached
acepanel app write memcached ${channel} ${version}
echo -e $HR
echo "Upgrade successful"
echo -e $HR