1

I've been trying to get redis to run as a service on a CentOS 6 server but I cant get the startup script to work properly.

the startup script distributed with redis does not support chkconfig so I found another on github at https://gist.github.com/tahajahangir/155176867afed0ff80ad however lines 36 & 37:

chown ${REDIS_USER-redis}:${REDIS_USER-redis} /var/run/redis
daemon --user ${REDIS_USER-redis} "$redis $REDIS_CONF_FILE $REDIS_OPTIONS" 

give errors when I run service redis-server start. I solved the first error about incorrect username redis by changing line 36 to

chown root:root /var/run/redis

but I still have the remaining error:

/usr/bin/dirname: extra operand `.pid'
Try `/usr/bin/dirname --help' for more information.

I've tried several things but I'm not entirely sure where this "extra" .pid is coming from. How can I resolve this?

  • In the last comment on the page you posted should be the solution to your problem.You have to change line 37 to: daemon --user ${REDIS_USER-redis} --pidfile ${pidfile} "$redis $REDIS_CONF_FILE $REDIS_OPTIONS" – LilloX Nov 4 '15 at 16:01
  • Many thanks, I had actually tried the --pid part at the end of the line but that had no effect, adding it before the other path options seems to do the trick. If youd like to make your comment an answwer Ill accept. – Toby Nov 4 '15 at 16:09
1

In the last comment on the page you posted should be the solution to your problem.You have to change line 37 to:

daemon --user ${REDIS_USER-redis} --pidfile ${pidfile} "$redis $REDIS_CONF_FILE $REDIS_OPTIONS"

0

You should consider using a packaged version of redis, which will work as soon as you install it. For CentOS 6, EPEL has redis 2.4.10. You can also get the latest 2.8 and 3.0 versions of redis from the IUS project.

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.