Lines 6-11
Link Here
|
6 |
RC_GOT_SERVICES="yes" |
6 |
RC_GOT_SERVICES="yes" |
7 |
|
7 |
|
8 |
[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh |
8 |
[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh |
|
|
9 |
[[ ${RC_GOT_LOCKING} != "yes" ]] && source "${svclib}/sh/rc-locking.sh" |
9 |
|
10 |
|
10 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
11 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
11 |
# Only try and update if we are root |
12 |
# Only try and update if we are root |
Lines 357-375
Link Here
|
357 |
mark_service_stopped "${service}" |
358 |
mark_service_stopped "${service}" |
358 |
return 1 |
359 |
return 1 |
359 |
fi |
360 |
fi |
|
|
361 |
|
362 |
lock "status" |
363 |
|
364 |
if service_starting "${service}" || |
365 |
service_started "${service}" |
366 |
then |
367 |
unlock "status" |
368 |
return 0 |
369 |
fi |
360 |
|
370 |
|
361 |
service_starting "${service}" && return 0 |
371 |
if service_inactive "${service}" ; then |
362 |
service_started "${service}" && return 0 |
372 |
unlock "status" |
363 |
service_inactive "${service}" && return 1 |
373 |
return 1 |
|
|
374 |
fi |
364 |
|
375 |
|
365 |
if is_fake_service "${service}" "${SOFTLEVEL}" ; then |
376 |
if is_fake_service "${service}" "${SOFTLEVEL}" ; then |
366 |
mark_service_started "${service}" |
377 |
mark_service_started "${service}" |
|
|
378 |
unlock "status" |
367 |
splash "svc_start" "${service}" |
379 |
splash "svc_start" "${service}" |
368 |
splash "svc_started" "${service}" "0" |
380 |
splash "svc_started" "${service}" "0" |
369 |
return 0 |
381 |
return 0 |
370 |
fi |
382 |
fi |
371 |
|
383 |
|
372 |
begin_service "${service}" || return 0 |
384 |
if ! begin_service "${service}" ; then |
|
|
385 |
unlock "status" |
386 |
return 0 |
387 |
fi |
388 |
|
389 |
unlock "status" |
390 |
|
373 |
splash "svc_start" "${service}" |
391 |
splash "svc_start" "${service}" |
374 |
if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ |
392 |
if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ |
375 |
${START_CRITICAL} == "yes" ]] ; then |
393 |
${START_CRITICAL} == "yes" ]] ; then |
Lines 405-412
Link Here
|
405 |
return 0 |
423 |
return 0 |
406 |
fi |
424 |
fi |
407 |
|
425 |
|
408 |
service_stopping "${service}" && return 0 |
426 |
lock "status" |
409 |
service_stopped "${service}" && return 0 |
427 |
|
|
|
428 |
if service_stopping "${service}" || |
429 |
service_stopped "${service}" |
430 |
then |
431 |
unlock "status" |
432 |
return 0 |
433 |
fi |
410 |
|
434 |
|
411 |
local level="${SOFTLEVEL}" |
435 |
local level="${SOFTLEVEL}" |
412 |
is_runlevel_stop && level="${OLDSOFTLEVEL}" |
436 |
is_runlevel_stop && level="${OLDSOFTLEVEL}" |
Lines 414-424
Link Here
|
414 |
if is_fake_service "${service}" "${level}" ; then |
438 |
if is_fake_service "${service}" "${level}" ; then |
415 |
splash "svc_stop" "${service}" |
439 |
splash "svc_stop" "${service}" |
416 |
mark_service_stopped "${service}" |
440 |
mark_service_stopped "${service}" |
|
|
441 |
unlock "status" |
417 |
splash "svc_stopped" "${service}" "0" |
442 |
splash "svc_stopped" "${service}" "0" |
418 |
return 0 |
443 |
return 0 |
419 |
fi |
444 |
fi |
420 |
|
445 |
|
421 |
begin_service "${service}" || return 0 |
446 |
if ! begin_service "${service}" ; then |
|
|
447 |
unlock "status" |
448 |
return 0 |
449 |
fi |
450 |
unlock "status" |
422 |
|
451 |
|
423 |
splash "svc_stop" "${service}" |
452 |
splash "svc_stop" "${service}" |
424 |
if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ |
453 |
if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ |
Lines 449-454
Link Here
|
449 |
mark_service_starting() { |
478 |
mark_service_starting() { |
450 |
[[ -z $1 ]] && return 1 |
479 |
[[ -z $1 ]] && return 1 |
451 |
|
480 |
|
|
|
481 |
lock "status" |
482 |
|
452 |
ln -snf "/etc/init.d/$1" "${svcdir}/starting/$1" |
483 |
ln -snf "/etc/init.d/$1" "${svcdir}/starting/$1" |
453 |
local retval=$? |
484 |
local retval=$? |
454 |
|
485 |
|
Lines 456-461
Link Here
|
456 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
487 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
457 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
488 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
458 |
|
489 |
|
|
|
490 |
unlock "status" |
491 |
|
459 |
return "${retval}" |
492 |
return "${retval}" |
460 |
} |
493 |
} |
461 |
|
494 |
|
Lines 466-471
Link Here
|
466 |
mark_service_started() { |
499 |
mark_service_started() { |
467 |
[[ -z $1 ]] && return 1 |
500 |
[[ -z $1 ]] && return 1 |
468 |
|
501 |
|
|
|
502 |
lock "status" |
503 |
|
469 |
ln -snf "/etc/init.d/$1" "${svcdir}/started/$1" |
504 |
ln -snf "/etc/init.d/$1" "${svcdir}/started/$1" |
470 |
local retval=$? |
505 |
local retval=$? |
471 |
|
506 |
|
Lines 473-478
Link Here
|
473 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
508 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
474 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
509 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
475 |
|
510 |
|
|
|
511 |
unlock "status" |
512 |
|
476 |
return "${retval}" |
513 |
return "${retval}" |
477 |
} |
514 |
} |
478 |
|
515 |
|
Lines 483-494
Link Here
|
483 |
mark_service_inactive() { |
520 |
mark_service_inactive() { |
484 |
[[ -z $1 ]] && return 1 |
521 |
[[ -z $1 ]] && return 1 |
485 |
|
522 |
|
|
|
523 |
lock "status" |
524 |
|
486 |
ln -snf "/etc/init.d/$1" "${svcdir}/inactive/$1" |
525 |
ln -snf "/etc/init.d/$1" "${svcdir}/inactive/$1" |
487 |
local retval=$? |
526 |
local retval=$? |
488 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
527 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
489 |
[[ -f "${svcdir}/starting/$1" ]] && rm -f "${svcdir}/starting/$1" |
528 |
[[ -f "${svcdir}/starting/$1" ]] && rm -f "${svcdir}/starting/$1" |
490 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
529 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
491 |
|
530 |
|
|
|
531 |
unlock "status" |
532 |
|
492 |
return "${retval}" |
533 |
return "${retval}" |
493 |
} |
534 |
} |
494 |
|
535 |
|
Lines 499-504
Link Here
|
499 |
mark_service_stopping() { |
540 |
mark_service_stopping() { |
500 |
[[ -z $1 ]] && return 1 |
541 |
[[ -z $1 ]] && return 1 |
501 |
|
542 |
|
|
|
543 |
lock "status" |
544 |
|
502 |
ln -snf "/etc/init.d/$1" "${svcdir}/stopping/$1" |
545 |
ln -snf "/etc/init.d/$1" "${svcdir}/stopping/$1" |
503 |
local retval=$? |
546 |
local retval=$? |
504 |
|
547 |
|
Lines 506-511
Link Here
|
506 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
549 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
507 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
550 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
508 |
|
551 |
|
|
|
552 |
unlock "status" |
553 |
|
509 |
return "${retval}" |
554 |
return "${retval}" |
510 |
} |
555 |
} |
511 |
|
556 |
|
Lines 516-527
Link Here
|
516 |
mark_service_stopped() { |
561 |
mark_service_stopped() { |
517 |
[[ -z $1 ]] && return 1 |
562 |
[[ -z $1 ]] && return 1 |
518 |
|
563 |
|
|
|
564 |
lock "status" |
565 |
|
519 |
[[ -f "${svcdir}/daemons/$1" ]] && rm -f "${svcdir}/daemons/$1" |
566 |
[[ -f "${svcdir}/daemons/$1" ]] && rm -f "${svcdir}/daemons/$1" |
520 |
[[ -f "${svcdir}/starting/$1" ]] && rm -f "${svcdir}/starting/$1" |
567 |
[[ -f "${svcdir}/starting/$1" ]] && rm -f "${svcdir}/starting/$1" |
521 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
568 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
522 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
569 |
[[ -f "${svcdir}/inactive/$1" ]] && rm -f "${svcdir}/inactive/$1" |
523 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
570 |
[[ -f "${svcdir}/stopping/$1" ]] && rm -f "${svcdir}/stopping/$1" |
524 |
|
571 |
|
|
|
572 |
unlock "status" |
573 |
|
525 |
return $? |
574 |
return $? |
526 |
} |
575 |
} |
527 |
|
576 |
|
Lines 580-590
Link Here
|
580 |
service_stopped() { |
629 |
service_stopped() { |
581 |
[[ -z $1 ]] && return 1 |
630 |
[[ -z $1 ]] && return 1 |
582 |
|
631 |
|
583 |
service_starting "$1" && return 1 |
632 |
lock "status" |
584 |
service_started "$1" && return 1 |
633 |
|
585 |
service_stopping "$1" && return 1 |
634 |
if service_starting "$1" || |
586 |
service_inactive "$1" && return 1 |
635 |
service_started "$1" || |
|
|
636 |
service_stopping "$1" || |
637 |
service_inactive "$1" |
638 |
then |
639 |
unlock "status" |
640 |
return 1 |
641 |
fi |
587 |
|
642 |
|
|
|
643 |
unlock "status" |
588 |
return 0 |
644 |
return 0 |
589 |
} |
645 |
} |
590 |
|
646 |
|