1 Star 1 Fork 0

pantian/lnmp

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
redis_install.sh 1.78 KB
Copy Edit Raw Blame History
xiaoshenghuo authored 2016-10-21 17:14 . add redis
pathFile="redis-3.2.4"
serviceFile="/etc/init.d/redisd"
installPath="/usr/local/$pathFile/"
sourceFile="$pathFile.tar.gz"
configFile=$installPath$pathFile"/redis.conf"
pidFile=/var/run/redis.pid
if [ ! -d $installPath ];then
mkdir -p $installPath
else
#rm -rf $installPath/*
printf "删除 $installPath\n"
fi
if [ -f $sourceFile ];then
tar -zxvf $sourceFile
cd $pathFile && make
if [ $? == 0 ];then
cp -Rf ./src $installPath
cp redis.conf $installPath
sed -i '128c daemonize yes' ${installPath}redis.conf
if [ $? == 0 ];then
echo "";
echo "#!/bin/sh
# chkconfig: 2345 80 90
# description: redis auto run
#
redisServer=\"${installPath}src/redis-server\"
redisCli=\"${installPath}src/redis-cli\"
configFile=\"${installPath}redis.conf\"
pidFile=\"$pidFile\"
function start(){
if [ -f \"\$configFile\" ];then
if [ -f \$redisServer ];then
\$redisServer \$configFile
if [ \$? == 0 ];then
echo -e \"\033[32;49;1m [启动成功] \033[39;49;0m\"
else
printf \"启动失败\n\"
fi
else
printf \"服务文件 \$mongodFile 不存在\n\"
fi
else
printf \"配置文件不存在\n\"
fi
}
function stop(){
if [ -f \"\$redisCli\" ]; then
\$redisCli shutdown
if [ \$? == 0 ];then
printf \"\t server stop OK \n\"
return 0
fi
else
printf \"\t server is not run\n\"
return 2
fi
}
case \$1 in
start )
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
*)
start
;;
esac">$serviceFile
echo "servier file : $serviceFile \n"
chmod +x $serviceFile;
fi
else
printf "install fail \n"
fi
else
printf "$sourceFile 不存在\n"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/pantian/lnmp.git
git@gitee.com:pantian/lnmp.git
pantian
lnmp
lnmp
master

Search

D67c1975 1850385 1daf7b77 1850385