普通用户启动redis

重庆231 Redis 服务器 redis用户启动

复制 /etc/init.d/redis 启动脚本到 /redisdata/redis3.2下面,修改内容

[root@localhost ~]# less /redisdata/redis3.2/redis6380
#!/bin/sh
#
# redis init file for starting up the redis daemon
#
# chkconfig: - 20 80
# description: Starts and stops the redis daemon.

# Source function library.
. /etc/rc.d/init.d/functions

name="redis-server"
exec="/usr/bin/$name"
pidfile="/redisdata/redis3.2/6380/redis6380.pid"
# REDIS_CONFIG="/etc/redis.conf"
REDIS_CONFIG="/redisdata/redis3.2/6380/redis6380.conf"

[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis

lockfile=/var/lock/subsys/redis

start() {
[ -f $REDIS_CONFIG ] || exit 6
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

修改/redisdata 目录归属 chowd -R redis:redis /redisdata

/redisdata/redis3.2/redis6380  start 启动 redis

[root@localhost ~]# ps -ef |grep redis
redis 5301 1 0 Feb16 ? 04:09:19 /usr/bin/redis-server 0.0.0.0:6379
redis 17079 1 0 15:20 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6380

 

附注:

pidfile /var/run/redis6380.pid
logfile /redisdata/redis3.2/6380/stdout
logfile /redisdata/redis3.2/6380/log/redis6380.log
dir /redisdata/redis3.2/6380/data
/usr/bin/redis-server /redisdata/redis3.2/6380/redis6380.conf

/redisdata/redis3.2/redis6380 启动脚本

 

posted @ 2017-03-22 15:39  Fatt  阅读(6846)  评论(0编辑  收藏  举报