Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Here is my current Upstart script I've placed at /etc/init/redis.conf:

description "redis server"

start on runlevel [2345]
stop on shutdown

exec sudo /opt/redis/redis-server /opt/redis/redis.conf
post-start exec sudo chmod 777 /tmp/redis.sock


What I am trying to do is start the redis server, then once its running immediately change the permissions of the socket file it creates to be more permissive.

Unfortunately there is currently no way to configure redis to set the socket permissions to anything other than 755, which is too restrictive for my use case.

This script does not work. It effectively starts up the redis server but the unix file permissions remain the same.

Any idea how I can go about accomplishing the goal of changing the socket permissions right after redis starts while retaining the ability to manage redis through upstart?

share|improve this question
Side point - you don't need the sudo in your exec parts, the script will be run as root. – Hamish Downer Oct 18 '11 at 22:41
Thanks. That's good to know. – Carl Zulauf Oct 18 '11 at 22:54
up vote 2 down vote accepted

It's possible that redis hasn't created the socket at the point the post-start exec runs. You could try changing the post-start line to:

post-start script
  sleep 5
  chmod 777 /tmp/redis.sock
end script
share|improve this answer
Doesn't work as an exec line, but does work if I use a script block and execute sleep first. If you can update the answer I'll accept it. Working script is here: – Carl Zulauf Oct 18 '11 at 23:02

Your Answer


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.