[Pm-utils] bug in stopservice() and restartservice()
Stefan Seyfried
seife at suse.de
Sat Dec 23 13:54:09 PST 2006
Hi,
today i got this nice bug:
https://bugzilla.novell.com/show_bug.cgi?id=230627
Basically, the problem is, that services with init scripts that have
dashes or dots in their names (novell-zmd, hotkey-setup, boot.clock)
cannot be stopped or started by these functions.
Suggested patch:
Index: pm/functions
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
retrieving revision 1.32
diff -u -p -r1.32 functions
--- pm/functions 30 Nov 2006 20:07:04 -0000 1.32
+++ pm/functions 23 Dec 2006 21:52:49 -0000
@@ -214,14 +214,16 @@ stopservice()
{
service "$1" status 2>/dev/null | grep -c -q running
if [ "$?" == "0" -a -x "/etc/init.d/$1" ]; then
- echo "export ${1}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
+ FOO=${1//[-.]/_}
+ echo "export ${FOO}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
"/etc/init.d/$1" stop 2>&1
fi
}
restartservice()
{
- if [ "x$(eval echo \$${1}_SERVICE_ACTIVATE)" == "xyes" \
+ FOO=${1//[-.]/_}
+ if [ "x$(eval echo \$${FOO}_SERVICE_ACTIVATE)" == "xyes" \
-a -x "/etc/init.d/$1" ]; then
"/etc/init.d/$1" start 2>&1
fi
Merry Xmas :-)
--
Stefan Seyfried
QA / R&D Team Mobile Devices | "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."
More information about the Pm-utils
mailing list