From 32cb494970d00324ebe50f48b90e76faed749986 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 4 Oct 2011 01:29:54 -0700 Subject: start-memcached writing wrong PID to $pidfile after the doublefork was added, the pidfile was now of the intermediary pid, not the one forked after setsid. --- scripts/start-memcached | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/start-memcached b/scripts/start-memcached index aa9dabe..ce39fa6 100755 --- a/scripts/start-memcached +++ b/scripts/start-memcached @@ -112,18 +112,17 @@ if($pid == 0) # must fork again now that tty is closed $pid = fork(); if ($pid) { + if(open PIDHANDLE,">$pidfile") + { + print PIDHANDLE $pid; + close PIDHANDLE; + }else{ + + print STDERR "Can't write pidfile to $pidfile.\n"; + } exit(0); } exec "$memcached $params"; exit(0); -}else{ - if(open PIDHANDLE,">$pidfile") - { - print PIDHANDLE $pid; - close PIDHANDLE; - }else{ - - print STDERR "Can't write pidfile to $pidfile.\n"; - } } -- cgit v1.2.1