為了方便地重啟redis服務 以下為配置service快速啟動或停止redis服務的步驟
第一步:首先 進入redis安裝目錄中的utils中
第二步:將其中的redis_init_script檔案複製到/etc/init.d下
第三步:進入/etc/init.d 將redis_init_script更名為redis
第四步:命令:mv redis_init_script redis
第五步:編輯redis
vim /etc/init.d/redis
進入後編輯這些為你的redis安裝目錄
修改後的如下
#!/bin/sh
## ****** redis init.d script conceived to work on linux systems
# as it does use of the /proc filesystem.
redisport=6379
exec=/var/www/redis-stable/src/redis-server
cliexec=/var/www/redis-stable/src/redis-cli
pidfile=/var/redis/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 "root" -p $redisport shutdown
while [ -x /proc/$ ]
doecho "waiting for redis to shutdown ..."
sleep 1
done
echo "redis stopped"
fi;;
restart)
if [ ! -f $pidfile ]
then
echo "$pidfile does not exist, process is not running"
else
pid=$(cat $pidfile)
echo "stopping ..."
$cliexec -a "root" -p $redisport shutdown
while [ -x /proc/$ ]
doecho "restarting redis server..."
done
$exec $conf
pidfile=/var/redis/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 "root" -p $redisport shutdown
while [ -x /proc/$ ]
doecho "waiting for redis to shutdown ..."
sleep 1
done
echo "redis stopped"
fi;;
restart)
if [ ! -f $pidfile ]
then
echo "$pidfile does not exist, process is not running"
else
pid=$(cat $pidfile)
echo "stopping ..."
$cliexec -a "root" -p $redisport shutdown
while [ -x /proc/$ ]
doecho "restarting redis server..."
done
$exec $conf
echo "redis restart success!"
fi;;
*)echo "please use start or stop as first argument"
;;esac
結束:這樣就可以在用service redis stop、service redis start對redis進行快速啟動停止了。
centos下為php新增pdo mysql擴充套件
第一步 進入到php的原始碼目錄下的ext pdo mysql目錄 這裡是原始碼目錄,不是安裝目錄,注意區別 第二步 執行 bin phpize 注 這裡的指的是php的安裝目錄,如果安裝到了 usr local php,那就執行 usr local php bin phpize,這裡是要生成.co...
centos下為php新增pdo mysql擴充套件
第一步 進入到php的原始碼目錄下的ext pdo mysql目錄 這裡是原始碼目錄,不是安裝目錄,注意區別 第二步 執行 bin phpize 注 這裡的指的是php的安裝目錄,如果安裝到了 usr local php,那就執行 usr local php bin phpize,這裡是要生成.co...
windows下為mysql新增日誌
mysql的配置檔案 mysqld log error d phpstudy log mysql mysql log err.txt log d phpstudy log mysql mysql log.txt long query time 2 log slow queries d phpstud...