Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
$redis-cli
Could not connect to Redis at 127.0.0.1:6379: 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 10.19.2.94 closed.

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

share|improve this question

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.

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

Your Answer

 
discard

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

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