Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just upgraded our Redis from 2.2.2 to 2.4.1 (I use http://www.dotdeb.org/ for package management), and now,

/etc/init.d/redis-server start

creates /var/run/redis/redis-server.pid, but the content of the pidfile is empty.

I can't stop the server simply with /etc/init.d/redis-server stop (that does nothing) and I have to manually kill ${pid}.

Am I doing anything wrong here?

Here's the init script that is installed by the redis-server package.

#! /bin/sh
### BEGIN INIT INFO
# Provides:     redis-server
# Required-Start:   $syslog $remote_fs
# Required-Stop:    $syslog $remote_fs
# Should-Start:     $local_fs
# Should-Stop:      $local_fs
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description:    redis-server - Persistent key-value db
# Description:      redis-server - Persistent key-value db
### END INIT INFO


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/redis-server
DAEMON_ARGS=/etc/redis/redis.conf
NAME=redis-server
DESC=redis-server

RUNDIR=/var/run/redis
PIDFILE=$RUNDIR/redis-server.pid

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
    echo -n "Starting $DESC: "
    mkdir -p $RUNDIR
    touch $PIDFILE
    chown redis:redis $RUNDIR $PIDFILE
    chmod 755 $RUNDIR
    if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS
    then
        echo "$NAME."
    else
        echo "failed"
    fi
    ;;
  stop)
    echo -n "Stopping $DESC: "
    if start-stop-daemon --stop --retry forever/QUIT/1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
    then
        echo "$NAME."
    else
        echo "failed"
    fi
    rm -f $PIDFILE
    ;;

  restart|force-reload)
    ${0} stop
    ${0} start
    ;;

  status)
    echo -n "$DESC is "
    if start-stop-daemon --stop --quiet --signal 0 --name ${NAME} --pidfile ${PIDFILE}
    then
        echo "running"
    else
        echo "not running"
        exit 1
    fi
    ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0
share|improve this question
2  
grep ^pidfile /etc/redis/redis.conf? –  quanta Oct 26 '11 at 4:14
    
Ahhh thank you, I added and it worked! :D –  kenn Oct 26 '11 at 5:33
    
I have the same problem, I've changed pidfile in redis.conf to /var/run/redis/redis-server.pid but still the pidfile is empty. Any idea how to solve it? –  Tombart Sep 28 '13 at 20:22
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.