Bug 85436

Summary: When resuming, services are restarted before network
Product: [Retired] Red Hat Linux Reporter: Pekka Pessi <pekka.pessi>
Component: apmdAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: rvokal, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.0.2-19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-05-19 20:37:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pekka Pessi 2003-03-02 19:20:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
The apmscript restarts services first, before restarting network.


Version-Release number of selected component (if applicable): 
apmd-3.0.2-12

How reproducible:
Always

Steps to Reproduce:
1. Start named on laptop. Set NET_RESTART="yes" and
   RESTORESERVICES="named" in /etc/sysconfig/apmd
2. Suspend.
3. Resume.
    

Actual Results:  Named (bind-9.2.1) tries to start, but fails because no
nw ifs (beside lo?) are available. 
    

Expected Results:  Named should be running normally. It should have been
restarted only after network is up and running.

Additional info: Here is my patch:
--- /etc/sysconfig/apm-scripts/apmscript.orig	2003-03-02 20:54:42.000000000 +0200
+++ /etc/sysconfig/apm-scripts/apmscript	2003-03-02 20:52:10.000000000 +0200
@@ -39,10 +39,15 @@
 	[ -f /etc/sysconfig/apm-scripts/apmcontinue-pre ] &&
/etc/sysconfig/apm-scripts/apmcontinue-pre
 	# Stop services that might break
 	echo "#!/bin/sh" >/var/run/apm-resume-post
+	post_services=""
+
 	if [ -n "$RESTORESERVICES" ]; then
 		for i in $RESTORESERVICES; do
 			if /sbin/service $i status &>/dev/null; then
-				echo "/sbin/service $i start" >>/var/run/apm-resume-post
+				# Make sure services are restarted in reverse order
+				# and after network has been restarted
+				post_services="/sbin/service $i start
+$post_services" 
 				/sbin/service $i stop &>/dev/null
 			fi
 		done
@@ -181,6 +186,8 @@
 	fi
 	sync
 
+	echo "$post_services" >> /var/run/apm-resume-post
+
 	[ -f /etc/sysconfig/apm-scripts/apmcontinue ] && .
/etc/sysconfig/apm-scripts/apmcontinue "$@"
 
 	[ -e /var/run/apm-resume-post ] && chmod 0755 /var/run/apm-resume-post

Comment 1 Bill Nottingham 2003-05-19 20:37:33 UTC
Fixed differently in 3.0.2-19.