How to make sure that memcached daemon is started by default on boot?
On server installations, we need to ensure that memcached is automatically started on boot if it's not already.
Check if memcached is already running or not:
/etc/init.d/memcached status* memcached is running
If you want to disable starting memcached on boot:
sudo update-rc.d memcached disable
If you want to re-enable memcached to start on boot:
sudo update-rc.d memcached enable
To ensure it's running in the default run levels:
sudo update-rc.d memcached defaults
We are using update-rc.d
script to create and delete symbolic links at /etc/rcX.d/
where X
is the runlevel number.
Those symlinks are scanned on boot and they control whether the service is going to be started or not, based on the initial letter.
If you have seen the output of update-rc.d memcached enable
Enabling system startup links for /etc/init.d/memcached. Removing any system startup links for /etc/init.d/memcached: /etc/rc0.d/K20memcached /etc/rc1.d/K20memcached /etc/rc2.d/K80memcached /etc/rc3.d/K80memcached /etc/rc4.d/K80memcached /etc/rc5.d/K80memcached /etc/rc6.d/K20memcached Adding system startup for /etc/init.d/memcached: /etc/rc0.d/K20memcached -> ../init.d/memcached /etc/rc1.d/K20memcached -> ../init.d/memcached /etc/rc6.d/K20memcached -> ../init.d/memcached /etc/rc2.d/S20memcached -> ../init.d/memcached /etc/rc3.d/S20memcached -> ../init.d/memcached /etc/rc4.d/S20memcached -> ../init.d/memcached /etc/rc5.d/S20memcached -> ../init.d/memcached
You will see that the symlinks may start with K
or S
. which indicates that in a certain runlevel, the system should Kill
or Start
the service, respectively.