From f55322afa8587adb99de6a88b47e87a4a3e0ee7a Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Thu, 24 Jan 2013 16:30:56 -0800 Subject: [PATCH] Corrected problem that prevented xserver init script from stopping xserver. Signed-off-by: Ossama Othman --- i386-common/xserver | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/i386-common/xserver b/i386-common/xserver index 8026ca8..dd94de1 100755 --- a/i386-common/xserver +++ b/i386-common/xserver @@ -5,10 +5,11 @@ set -e export DISPLAY=:0 export PATH=/bin:/usr/bin/:/sbin:/usr/sbin +is_running=`pidof Xorg` || true + case "$1" in start) - is_running=`ps | grep -v grep | awk '{ print \$6 }' | grep Xorg` || true - if [ "${is_running}" = "" ]; then + if [ "${is_running}" = "" ]; then echo "Starting Xorg server..." /usr/bin/startx else @@ -17,8 +18,7 @@ case "$1" in ;; restart|reload|force-reload) - is_running=`ps | grep -v grep | awk '{ print \$6 }' | grep Xorg` || true - if [ "${is_running}" != "" ]; then + if [ "${is_running}" != "" ]; then $0 stop || true sleep 3 fi @@ -26,8 +26,7 @@ case "$1" in ;; stop) - is_running=`ps | grep -v grep | awk '{ print \$6 }' | grep Xorg` || true - if [ "${is_running}" != "" ]; then + if [ "${is_running}" != "" ]; then echo "Stopping Xorg server..." killall -9 Xorg else @@ -36,7 +35,6 @@ case "$1" in ;; status) - is_running=`ps | grep -v grep | awk '{ print \$6 }' | grep Xorg` || true if [ "${is_running}" = "" ]; then echo "Xorg server is not running..." else -- 2.7.4