#!/bin/bash

set -eux

# On debian-based distros set memcached daemon to listen on port 0.0.0.0
# This is the default on RedHat-based distros.
# Without this setting the memcached daemon will suffer connection errors
if [[ "ubuntu debian" =~ "$DISTRO_NAME" ]]; then
    sed -i -r "s/\-l( )*(([0-9]{1,3}\.){3}[0-9]{1,3})/\-l 0\.0\.0\.0/" /etc/memcached.conf
fi

os-svc-enable -n memcached
