[Pm-utils] bug in stopservice() and restartservice()
Stefan Seyfried
seife at suse.de
Wed Feb 14 03:42:18 PST 2007
On Sat, Dec 23, 2006 at 10:54:09PM +0100, Stefan Seyfried wrote:
> 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.
Ping! :-)
This is still needed (or something similar);
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 14 Feb 2007 11:39:41 -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
--
Stefan Seyfried
"Any ideas, John?"
"Well, surrounding them's out."
More information about the Pm-utils
mailing list