4
# 2003 - Jay Bonci <jaybonci@debian.org>
5
# This script handles the parsing of the /etc/memcached.conf file
6
# and was originally created for the Debian distribution.
7
# Anyone may use this little script under the same terms as
12
if($> != 0 and $< != 0)
14
print STDERR "Only root wants to run start-memcached.\n";
18
my $params; my $etchandle; my $etcfile = "/etc/memcached.conf";
19
my $memcached = "/usr/bin/memcached";
20
my $pidfile = "/var/run/memcached.pid";
22
if(open $etchandle, $etcfile)
24
foreach my $line (<$etchandle>)
31
next if $line =~ /\-[dvh]/;
40
push @$params, "-u root" unless(grep "-u", @$params);
41
$params = join " ", @$params;
45
open PIDHANDLE, "$pidfile";
46
my $localpid = <PIDHANDLE>;
50
if(-d "/proc/$localpid")
52
print STDERR "memcached is already running.\n";
64
exec "$memcached $params";
68
if(open PIDHANDLE,">$pidfile")
74
print STDERR "Can't write pidfile to $pidfile.\n";