1.redis開啟守護程序
2.新增開啟啟動配置檔案,修改相應值為實際值,完整檔案見最後
3.修改新增redis啟動指令碼許可權為可執行
chmod +x redis
4./etc/init.d/stop 出現stopping ... (error) noauth authentication required. 錯誤,需要新增密碼訪問方式即可
5.配置redis開機啟動
chkconfig redis on
6.重啟系統,發現服務已經可以自啟動了啦。
附完整redis自啟動指令碼:
#!/bin/sh
## ****** redis init.d script conceived to work on linux systems
# as it does use of the /proc filesystem.
redisport=6379
exec=/usr/bin/redis-server
cliexec=/usr/bin/redis-cli
pidfile=/var/run/redis_$.pid
conf="/etc/redis.conf"
case "$1" in
start)
if [ -f $pidfile ]
then
echo "$pidfile exists, process is already running or crashed"
else
echo "starting redis server..."
$exec $conf
fi;;
stop)
if [ ! -f $pidfile ]
then
echo "$pidfile does not exist, process is not running"
else
pid=$(cat $pidfile)
echo "stopping ..."
$cliexec -a 123456 -p $redisport shutdown
while [ -x /proc/$ ]
doecho "waiting for redis to shutdown ..."
sleep 1
done
echo "redis stopped"
fi;;
*)echo "please use start or stop as first argument"
;;esac
redis配置開機自啟動
系統開機啟動時會去載入 etc init.d 下面的指令碼,通常而言每個指令碼檔案會自定義實現程式的啟動 若想將新的程式開機自啟動,只需在該目錄下新增乙個自定義啟動程式的指令碼,然後設定相應規則即可。2.1首先我們找到redis的檔案目錄 然後進入utils中,輔助檔案到我們的指令碼啟動處 3.1編...
redis配置為開機自啟動
將redis設定為系統服務,並且開機自啟動。需要完成以下指令碼。bin sh chkconfig 2345 10 90 description start and stop redis path usr local bin sbin usr bin bin redisport 6379 exec u...
redis開機自啟動
一.啟動redis 1.redis server 這種方式啟動,當按ctrl c退出時會關閉啟動 2.redis server 加上 號使redis以後台程式方式執行 二.檢測redis程序後台是否存在的三種方法 1.ps ef grep redis 檢視redis程序 2.netstat lntp...