I have installed memcache on a Dreamhost VPS (Debian GNU/Linux 5.0.9 (lenny) / memcached 1.4.10 ) for a Drupal site .
If for some reason the server needs rebooting, memcache is not restarted and Drupal spits out warnings about not being able to find memcache.
As mentioned in a previous question, I'm using the following script to start & configure memcache
sudo /etc/init.d/memcached
- Is it possible to call that script whenever the server is rebooted, if yes how?
- In case, the above is not possible or fails, how and where could I tell Drupal to bypass memcache.
//pseudo code
if( memcache == null )
bypass memcache
EDIT
@Jon Thanks for the template but it's still above my current scripting level! Since I'm only running a single instance of memcache, here's what I have so far
#! /bin/bash
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: memcached - Memory caching daemon
# Description: memcached - Memory caching daemon
### END INIT INFO#!/bin/sh -e
memcached -u www-data -p 11211 -m 128 -d -l 127.0.0.1
It works fine, except that the script is not called after a server reboot! I need help to make this fit with the template structure. I have no idea about the stop or restart command...
The command is: update-rc.d memcached defaults
You can always man update-rc.d and get more details, but that should install the init script.
Sorry, can't answer for drupal.
If it's on debian, then install memcached with
apt-get install memcached php5-memcached
. It will automatically populate init.d with the required start/stop script, so first remove your tampered memcached start script from init.d and the runlevels either by deleting it manually or give outupdate-rc.d memcached remove
. Then do the apt-get install... And it will auto start/stop each and every time.