0

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?

Régis B.
  • 193
  • 1
  • 13
  • 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 00:42

1 Answers1

2

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
Régis B.
  • 193
  • 1
  • 13
  • 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 04:00