I'm trying to launch redis-server as a user (called redis) via Upstart. My /etc/init/redis-server.conf looks like this:

description "redis server"

start on runlevel [23]
stop on shutdown

exec sudo -u redis /usr/local/bin/redis-server /var/lib/redis/redis.conf

Looks good, right? I start redis-server using

$start redis-server
redis-server start/running, process 16808
Could not connect to Redis at Connection refused
$ps ax | grep ps 168
16810  tty1    R+     0:00 ps ax
16811  tty1    S+     0:00 grep 168

So redis-server definitely isn't running. Let's try executing the Upstart command by hand, shall we?

exec sudo -u redis /usr/local/bin/redis-server /var/lib/redis/redis.conf
[16852] 19 Jun 10:37:21 # Can't chdir to './': Permission denied
Connection to closed.

And then I get logged off. I'm at a loss. Any ideas?

2 Answers 2


You're getting logged off because when exec complements, the shell exists. This is true whether the command succeeds or fails (try exec echo hello for example). So, to avoid getting logged out, use this instead:

sudo -u redis /usr/local/bin/redis-server /var/lib/redis/redis.conf

That may not solve your issue, but it will make your testing go faster.

  • That's one issue down, 99 to go.
    – Chris
    Jun 19, 2012 at 15:42

Okay, so the issue was caused by the redis user not being able to execute the redis-server binary from /home/root. Some research reveals that many folks have had problems using Upstart under CentOS. The eventual solution was to use this Redis init.d script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.