/[vps]/baselayout-vserver/trunk/sbin/runscript.sh
Gentoo

Diff of /baselayout-vserver/trunk/sbin/runscript.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 235 Revision 236
552 # stopped services come back up again when started. 552 # stopped services come back up again when started.
553 if [[ ${IN_BACKGROUND} == "true" ]] ; then 553 if [[ ${IN_BACKGROUND} == "true" ]] ; then
554 rm -rf "${svcdir}/snapshot/$$" 554 rm -rf "${svcdir}/snapshot/$$"
555 mkdir -p "${svcdir}/snapshot/$$" 555 mkdir -p "${svcdir}/snapshot/$$"
556 cp -pP "${svcdir}"/started/* "${svcdir}/snapshot/$$/" 556 cp -pP "${svcdir}"/started/* "${svcdir}/snapshot/$$/"
557 rm -f "${svcdir}/snapshot/$$/${myservice}"
557 fi 558 fi
558 559
559 svc_stop 560 svc_stop
560 retval="$?" 561 retval="$?"
561 562
595 596
596 # Create a snapshot of started services 597 # Create a snapshot of started services
597 rm -rf "${svcdir}/snapshot/$$" 598 rm -rf "${svcdir}/snapshot/$$"
598 mkdir -p "${svcdir}/snapshot/$$" 599 mkdir -p "${svcdir}/snapshot/$$"
599 cp -pP "${svcdir}"/started/* "${svcdir}/snapshot/$$/" 600 cp -pP "${svcdir}"/started/* "${svcdir}/snapshot/$$/"
601 rm -f "${svcdir}/snapshot/$$/${myservice}"
600 602
601 # Simple way to try and detect if the service use svc_{start,stop} 603 # Simple way to try and detect if the service use svc_{start,stop}
602 # to restart if it have a custom restart() funtion. 604 # to restart if it have a custom restart() funtion.
603 if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "/etc/init.d/${myservice}") ]] ; then 605 if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "/etc/init.d/${myservice}") ]] ; then
604 if [[ -z $(egrep 'svc_stop' "/etc/init.d/${myservice}") || \ 606 if [[ -z $(egrep 'svc_stop' "/etc/init.d/${myservice}") || \
617 fi 619 fi
618 retval="$?" 620 retval="$?"
619 621
620 [[ -e "${svcdir}/scheduled/${myservice}" ]] \ 622 [[ -e "${svcdir}/scheduled/${myservice}" ]] \
621 && rm -Rf "${svcdir}/scheduled/${myservice}" 623 && rm -Rf "${svcdir}/scheduled/${myservice}"
622 624
623 # Restart dependencies as well 625 # Restart dependencies as well
624 for x in $(dolisting "${svcdir}/snapshot/$$/") ; do 626 for x in $(dolisting "${svcdir}/snapshot/$$/") ; do
625 if service_stopped "${x##*/}" ; then 627 if service_stopped "${x##*/}" ; then
626 if service_inactive "${myservice}" \ 628 if service_inactive "${myservice}" \
627 || service_wasinactive "${myservice}" ; then 629 || service_wasinactive "${myservice}" ; then
628 svc_schedule_start "${myservice}" "${x##*/}" 630 svc_schedule_start "${myservice}" "${x##*/}"
629 ewarn "WARNING: ${x##*/} is scheduled to start when ${myservice} has started." 631 ewarn "WARNING: ${x##*/} is scheduled to start when ${myservice} has started."
630 else 632 elif service_started "${myservice}" ; then
631 start_service "${x##*/}" 633 start_service "${x##*/}"
632 fi 634 fi
633 fi 635 fi
634 done 636 done
635 rm -rf "${svcdir}/snapshot/$$" 637 rm -rf "${svcdir}/snapshot/$$"

Legend:
Removed from v.235  
changed lines
  Added in v.236

  ViewVC Help
Powered by ViewVC 1.1.20