Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
That's one issue down, 99 to go. – Chris Jun 19 '12 at 15:42
up vote 0 down vote accepted

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .