Kouhei Sutou
null+****@clear*****
Thu Aug 22 16:48:34 JST 2013
Kouhei Sutou 2013-08-22 16:48:34 +0900 (Thu, 22 Aug 2013) New Revision: ad82e7fbe40977e49268e2764d89831bd9475ee9 https://github.com/groonga/groonga/commit/ad82e7fbe40977e49268e2764d89831bd9475ee9 Message: groonga-httpd-restart: use kill directly Because killproc is for stopping a process. Modified files: data/scripts/groonga-httpd-restart Modified: data/scripts/groonga-httpd-restart (+12 -19) =================================================================== --- data/scripts/groonga-httpd-restart 2013-08-22 16:16:40 +0900 (217391c) +++ data/scripts/groonga-httpd-restart 2013-08-22 16:48:34 +0900 (c36f775) @@ -23,17 +23,11 @@ PID_FILE=/var/run/groonga/${GROONGA_HTTPD}.pid OLD_PID_FILE=${PID_FILE}.oldbin STATUS_TIMEOUT=3 -# Source function library. -if [ -f /lib/lsb/init-functions ]; then - . /lib/lsb/init-functions - if [ -f /etc/default/${SERVICE_NAME} ]; then - . /etc/default/${SERVICE_NAME} - fi -elif [ -f /etc/init.d/functions ]; then - . /etc/init.d/functions - if [ -f /etc/sysconfig/${SERVICE_NAME} ]; then - . /etc/sysconfig/${SERVICE_NAME} - fi +# Source configuration. +if [ -f /etc/default/${SERVICE_NAME} ]; then + . /etc/default/${SERVICE_NAME} +elif [ -f /etc/sysconfig/${SERVICE_NAME} ]; then + . /etc/sysconfig/${SERVICE_NAME} fi wait_until () { @@ -55,15 +49,14 @@ if [ "$1" = "try-restart" ]; then fi fi -killproc -p ${PID_FILE} ${GROONGA_HTTPD} -USR2 +OLD_PID=$(cat ${PID_FILE}) +kill -USR2 ${OLD_PID} if ! wait_until [ -f ${OLD_PID_FILE} ]; then echo "Failed to start new groonga-httpd master." exit 1 fi -OLD_PID=$(cat ${OLD_PID_FILE}) - # Switch worker process. kill -WINCH ${OLD_PID} @@ -71,21 +64,21 @@ if ! wait_until [ -f "${PID_FILE}" ]; then echo "Failed to switch worker process." exit 2 fi -PID=$(cat ${PID_FILE}) +NEW_PID=$(cat ${PID_FILE}) -OLD_WORKER_PROCESSES=$(pgrep -P ${OLD_PID} | grep -v ${PID}) +OLD_WORKER_PROCESSES=$(pgrep -P ${OLD_PID} | grep -v ${NEW_PID}) for pid in ${OLD_WORKER_PROCESSES}; do wait_until ps --pid=${pid} > /dev/null done -OLD_WORKER_PROCESSES=$(pgrep -P ${OLD_PID} | grep -v ${PID}) +OLD_WORKER_PROCESSES=$(pgrep -P ${OLD_PID} | grep -v ${NEW_PID}) if [ -n "${OLD_WORKER_PROCESSES}" ]; then echo "Failed to stop old groonga-httpd worker process." - killproc -p ${PID_FILE} ${GROONGA_HTTPD} -QUIT + kill -QUIT ${NEW_PID} echo "Rollback to old groonga-httpd master." exit 2 fi # Stop old master process. -killproc -p ${OLD_PID_FILE} ${GROONGA_HTTPD} -QUIT +kill -QUIT ${OLD_PID} exit $? -------------- next part -------------- HTML����������������������������...Download