diff --git a/README.md b/README.md index 5e7511b0e..7218b3e18 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ If you find this module useful, send some bitcoins to 1Na3YFUmdxKxJLiuRXQYJU2kiN * $package_ensure = 'present' * $logfile = '/var/log/memcached.log' +* $pidfile = '/var/run/memcached.pid' (Debian family only, set to false to disable pidfile) * $max_memory = false * $item_size = false * $lock_memory = false (WARNING: good if used intelligently, google for -k key) diff --git a/manifests/init.pp b/manifests/init.pp index f469c7554..1d196c333 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,6 +5,7 @@ class memcached ( $package_ensure = 'present', $logfile = '/var/log/memcached.log', + $pidfile = '/var/run/memcached.pid', $manage_firewall = false, $max_memory = false, $item_size = false, diff --git a/spec/classes/memcached_spec.rb b/spec/classes/memcached_spec.rb index 11b1defa4..3357569f7 100644 --- a/spec/classes/memcached_spec.rb +++ b/spec/classes/memcached_spec.rb @@ -96,6 +96,12 @@ :install_dev => true, :processorcount => 1 }, + { + :pidfile => false, + }, + { + :pidfile => '/var/log/memcached.pid', + }, { :package_ensure => 'absent', :install_dev => true @@ -185,6 +191,9 @@ if(param_hash[:lock_memory]) expected_lines.push("-k") end + if(param_hash[:pidfile]) + expected_lines.push("-P #{param_hash[:pidfile]}") + end if(param_hash[:verbosity]) expected_lines.push("-vvv") end diff --git a/templates/memcached.conf.erb b/templates/memcached.conf.erb index 0ecc7d7d6..1586d9426 100644 --- a/templates/memcached.conf.erb +++ b/templates/memcached.conf.erb @@ -3,8 +3,10 @@ # Run memcached as a daemon. -d +<% if @pidfile -%> # pidfile --P /var/run/memcached.pid +-P <%= @pidfile %> +<% end -%> # Log memcached's output logfile <%= @logfile -%>