12 Mar 2007 Pts tarihinde, Stefan Seyfried şunları yazmıştı: 
> how about (untested!):

+1, We still need LC_ALL=C thing to be sure for output language, so here is 
the updated one :)

Cheers
-- 
S.Çağlar Onur <[EMAIL PROTECTED]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
Index: pm/functions
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
retrieving revision 1.36
diff -u -r1.36 functions
--- pm/functions	6 Mar 2007 19:59:05 -0000	1.36
+++ pm/functions	12 Mar 2007 12:45:48 -0000
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# To get rid of localized outputs
+export LC_ALL=C
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/pm-utils/bin
 
 # Default values go here.  It is important to _not_ initialize some
@@ -222,20 +224,33 @@
 	fi
 }
 
+myservice()
+{
+	type service >/dev/null 2>&1
+	if [ $? = 0 ]; then
+		service "$@"
+	elif [ -x "/etc/init.d/$1" ]; then
+		"/etc/init.d/$@"
+	else
+		echo "neither 'service' nor '/etc/init.d/$1' init-script found." >&2
+		echo "installation or configuration problem?" >&2
+		echo "command was: 'myservice $@'" >&2
+	fi
+}
+
 stopservice()
 {
-	service "$1" status 2>/dev/null | grep -c -q running
-	if [ "$?" == "0" -a -x "/etc/init.d/$1" ]; then
+	myservice "$1" status 2>/dev/null | grep -c -q running
+	if [ "$?" == "0" ]; then
 		echo "export ${1}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
-		"/etc/init.d/$1" stop 2>&1
+		myservice "$1" stop 2>&1
 	fi
 }
 
 restartservice()
 {
-	if [ "x$(eval echo \$${1}_SERVICE_ACTIVATE)" == "xyes" \
-			-a -x "/etc/init.d/$1" ]; then
-		"/etc/init.d/$1" start 2>&1
+	if [ "x$(eval echo \$${1}_SERVICE_ACTIVATE)" == "xyes" ]; then
+		myservice "$1" start 2>&1
 	fi
 }
 

Attachment: pgpKhfWswpYTC.pgp
Description: PGP signature

_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to