Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I am trying to get Redis to start every time my system reboots to make sure that the cache are availables to my webserver. What I did is that inserted the following line in my crontab:

@reboot redis-server /path/to/redis.conf

After rebooting my system, the cron logs indicate that the cronjob has run:

Aug 15 01:10:59 hostname cron[1097]: (CRON) INFO (Running @reboot jobs)
Aug 15 01:10:59 hostname CRON[1176]: (regis) CMD (redis-server /path/to/redis.conf)

However, the redis server is not running, and that's my problem. Note that the redis server starts just fine whenever I run the command line in bash.

What am I doing wrong?

share|improve this question

marked as duplicate by Iain, Jenny D, Tom O'Connor May 13 at 14:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Cron probably isn't the right tool for this. A process monitor like Monit would be a better choice, as it will be able to bring redis back up if it falls down when the server is running. If you're on Ubuntu/Debian, you can use Upstart to keep redis running. –  cjc Aug 15 '12 at 0:42

1 Answer 1

up vote 2 down vote accepted

I managed to solve this issue by giving the full path to redis-server to cron. The crontab now looks like this:

@reboot /usr/local/bin/redis-server /path/to/redis.conf
share|improve this answer
2  
Strongly recommended to use init scripts for your distribution so that proper start/stop is achieved and is consisted with your OS. –  Chida Aug 15 '12 at 4:00

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