summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/memcached.17
-rwxr-xr-xscripts/start-memcached44
2 files changed, 49 insertions, 2 deletions
diff --git a/doc/memcached.1 b/doc/memcached.1
index 8a52257..8c3d4d2 100644
--- a/doc/memcached.1
+++ b/doc/memcached.1
@@ -34,6 +34,10 @@ Assume the identity of <username> (only when run as root).
.B \-m <num>
Use <num> MB memory max to use for object storage; the default is 64 megabytes.
.TP
+.B \-M
+Instead of throwing items from the cache when max memory is reached, throw an
+error
+.TP
.B \-c <num>
Use <num> max simultaneous connections; the default is 1024.
.TP
@@ -45,6 +49,9 @@ suggestions.
.B \-p <num>
Listen on port <num>, the default is port 11211.
.TP
+.B \-r
+Maximize core file limit
+.TP
.B \-h
Show the version of memcached and a summary of options.
.TP
diff --git a/scripts/start-memcached b/scripts/start-memcached
index f71bc21..d4a3758 100755
--- a/scripts/start-memcached
+++ b/scripts/start-memcached
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# start-memcached
-# 2003 - Jay Bonci <jaybonci@debian.org>
+# 2003/2004 - Jay Bonci <jaybonci@debian.org>
# This script handles the parsing of the /etc/memcached.conf file
# and was originally created for the Debian distribution.
# Anyone may use this little script under the same terms as
@@ -16,9 +16,41 @@ if($> != 0 and $< != 0)
}
my $params; my $etchandle; my $etcfile = "/etc/memcached.conf";
+
+# This script assumes that memcached is located at /usr/bin/memcached, and
+# that the pidfile is writable at /var/run/memcached.pid
+
my $memcached = "/usr/bin/memcached";
my $pidfile = "/var/run/memcached.pid";
+# If we don't get a valid logfile parameter in the /etc/memcached.conf file,
+# we'll just throw away all of our in-daemon output. We need to re-tie it so
+# that non-bash shells will not hang on logout. Thanks to Michael Renner for
+# the tip
+my $fd_reopened = "/dev/null";
+
+ sub handle_logfile
+ {
+ my ($logfile) = @_;
+ $fd_reopened = $logfile;
+ }
+
+ sub reopen_logfile
+ {
+ my ($logfile) = @_;
+
+ open *STDERR, ">>$logfile";
+ open *STDOUT, ">>$logfile";
+ open *STDIN, ">>/dev/null";
+ $fd_reopened = $logfile;
+ }
+
+# This is set up in place here to support other non -[a-z] directives
+
+my $conf_directives = {
+ "logfile" => \&handle_logfile,
+};
+
if(open $etchandle, $etcfile)
{
foreach my $line (<$etchandle>)
@@ -28,7 +60,14 @@ if(open $etchandle, $etcfile)
$line =~ s/\s+$//g;
$line =~ s/^\s+//g;
next unless $line;
- next if $line =~ /\-[dvh]/;
+ next if $line =~ /^\-[dh]/;
+
+ if($line =~ /^[^\-]/)
+ {
+ my ($directive, $arg) = $line =~ /^(.*?)\s+(.*)/;
+ $conf_directives->{$directive}->($arg);
+ next;
+ }
push @$params, $line;
}
@@ -61,6 +100,7 @@ my $pid = fork();
if($pid == 0)
{
+ reopen_logfile($fd_reopened);
exec "$memcached $params";
exit(0);