Lines 91-114
Link Here
|
91 |
local ordservice= |
91 |
local ordservice= |
92 |
local was_inactive=false |
92 |
local was_inactive=false |
93 |
|
93 |
|
94 |
if service_stopping "${myservice}" ; then |
|
|
95 |
eerror "ERROR: \"${myservice}\" is already stopping." |
96 |
return 0 |
97 |
elif service_stopped "${myservice}" ; then |
98 |
eerror "ERROR: \"${myservice}\" has not yet been started." |
99 |
return 0 |
100 |
fi |
101 |
|
102 |
# Do not try to stop if it had already failed to do so on runlevel change |
94 |
# Do not try to stop if it had already failed to do so on runlevel change |
103 |
if is_runlevel_stop && service_failed "${myservice}" ; then |
95 |
if is_runlevel_stop && service_failed "${myservice}" ; then |
104 |
return 1 |
96 |
return 1 |
105 |
fi |
97 |
fi |
|
|
98 |
|
99 |
if service_stopped "${myservice}" ; then |
100 |
ewarn "WARNING: \"${myservice}\" has not yet been started." |
101 |
return 0 |
102 |
fi |
106 |
|
103 |
|
107 |
service_inactive "${myservice}" && was_inactive=true |
104 |
service_inactive "${myservice}" && was_inactive=true |
108 |
|
105 |
if ! mark_service_stopping "${myservice}" ; then |
109 |
# Remove symlink to prevent recursion |
106 |
ewarn "WARNING: \"${myservice}\" is already stopping." |
110 |
mark_service_stopping "${myservice}" |
107 |
return 0 |
111 |
|
108 |
fi |
|
|
109 |
# Lock service starting too ... |
110 |
mark_service_starting "${myservice}" |
111 |
|
112 |
service_message "Stopping service ${myservice}" |
112 |
service_message "Stopping service ${myservice}" |
113 |
|
113 |
|
114 |
if in_runlevel "${myservice}" "${BOOTLEVEL}" && \ |
114 |
if in_runlevel "${myservice}" "${BOOTLEVEL}" && \ |
Lines 212-217
Link Here
|
212 |
else |
212 |
else |
213 |
# Stop einfo/ebegin/eend from working as parallel messes us up |
213 |
# Stop einfo/ebegin/eend from working as parallel messes us up |
214 |
[[ ${RC_PARALLEL_STARTUP} == "yes" ]] && RC_QUIET_STDOUT="yes" |
214 |
[[ ${RC_PARALLEL_STARTUP} == "yes" ]] && RC_QUIET_STDOUT="yes" |
|
|
215 |
|
215 |
# Now that deps are stopped, stop our service |
216 |
# Now that deps are stopped, stop our service |
216 |
( stop ) |
217 |
( stop ) |
217 |
retval=$? |
218 |
retval=$? |
Lines 224-232
Link Here
|
224 |
if [[ ${retval} -ne 0 ]] ; then |
225 |
if [[ ${retval} -ne 0 ]] ; then |
225 |
# Did we fail to stop? create symlink to stop multible attempts at |
226 |
# Did we fail to stop? create symlink to stop multible attempts at |
226 |
# runlevel change. Note this is only used at runlevel change ... |
227 |
# runlevel change. Note this is only used at runlevel change ... |
227 |
if is_runlevel_stop ; then |
228 |
is_runlevel_stop && mark_service_failed "${myservice}" |
228 |
mark_service_failed "${myservice}" |
|
|
229 |
fi |
230 |
|
229 |
|
231 |
# If we are halting the system, do it as cleanly as possible |
230 |
# If we are halting the system, do it as cleanly as possible |
232 |
if [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" ]] ; then |
231 |
if [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" ]] ; then |
Lines 259-287
Link Here
|
259 |
local y= |
258 |
local y= |
260 |
local myserv= |
259 |
local myserv= |
261 |
local ordservice= |
260 |
local ordservice= |
|
|
261 |
local was_inactive=false |
262 |
|
262 |
|
263 |
if service_starting "${myservice}" ; then |
263 |
# Do not try to start if i have done so already on runlevel change |
264 |
ewarn "WARNING: \"${myservice}\" is already starting." |
264 |
if is_runlevel_start && service_failed "${myservice}" ; then |
|
|
265 |
return 1 |
266 |
fi |
267 |
|
268 |
if service_started "${myservice}" ; then |
269 |
ewarn "WARNING: \"${myservice}\" has already been started." |
265 |
return 0 |
270 |
return 0 |
266 |
elif service_stopping "${myservice}" ; then |
271 |
elif service_stopping "${myservice}" ; then |
267 |
ewarn "WARNING: please wait for \"${myservice}\" to stop first." |
272 |
eerror "ERROR: please wait for \"${myservice}\" to stop first." |
268 |
return 0 |
273 |
return 1 |
269 |
elif service_inactive "${myservice}" ; then |
274 |
elif service_inactive "${myservice}" ; then |
270 |
if [[ ${IN_BACKGROUND} != "true" ]] ; then |
275 |
if [[ ${IN_BACKGROUND} != "true" ]] ; then |
271 |
ewarn "WARNING: \"${myservice}\" has already been started." |
276 |
ewarn "WARNING: \"${myservice}\" has already been started." |
272 |
return 0 |
277 |
return 0 |
273 |
fi |
278 |
fi |
274 |
elif service_started "${myservice}" ; then |
|
|
275 |
ewarn "WARNING: \"${myservice}\" has already been started." |
276 |
return 0 |
277 |
fi |
279 |
fi |
278 |
|
280 |
|
279 |
# Do not try to start if i have done so already on runlevel change |
281 |
service_inactive "${myservice}" && was_inactive=true |
280 |
if is_runlevel_start && service_failed "${myservice}" ; then |
282 |
if ! mark_service_starting "${myservice}" ; then |
281 |
return 1 |
283 |
ewarn "WARNING: \"${myservice}\" is already starting." |
|
|
284 |
return 0 |
282 |
fi |
285 |
fi |
283 |
|
|
|
284 |
mark_service_starting "${myservice}" |
285 |
service_message "Starting service ${myservice}" |
286 |
service_message "Starting service ${myservice}" |
286 |
|
287 |
|
287 |
# On rc change, start all services "before $myservice" first |
288 |
# On rc change, start all services "before $myservice" first |
Lines 383-389
Link Here
|
383 |
# If we're booting, we need to continue and do our best to get the |
384 |
# If we're booting, we need to continue and do our best to get the |
384 |
# system up. |
385 |
# system up. |
385 |
if [[ ${SOFTLEVEL} != "${BOOTLEVEL}" ]]; then |
386 |
if [[ ${SOFTLEVEL} != "${BOOTLEVEL}" ]]; then |
386 |
mark_service_stopped "${myservice}" |
387 |
if ${was_inactive} ; then |
|
|
388 |
mark_service_inactive "${myservice}" |
389 |
else |
390 |
mark_service_stopped "${myservice}" |
391 |
fi |
387 |
fi |
392 |
fi |
388 |
|
393 |
|
389 |
service_message "eerror" "FAILED to start service ${myservice}!" |
394 |
service_message "eerror" "FAILED to start service ${myservice}!" |