rc.subr (131550) | rc.subr (132892) |
---|---|
1# $NetBSD: rc.subr,v 1.60 2003/07/26 05:13:47 lukem Exp $ | 1# $NetBSD: rc.subr,v 1.60 2003/07/26 05:13:47 lukem Exp $ |
2# $FreeBSD: head/etc/rc.subr 131550 2004-07-04 07:21:18Z cperciva $ | 2# $FreeBSD: head/etc/rc.subr 132892 2004-07-30 17:19:35Z mtm $ |
3# 4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 447 unchanged lines hidden (view full) --- 458run_rc_command() 459{ 460 _return=0 461 rc_arg=$1 462 if [ -z "$name" ]; then 463 err 3 'run_rc_command: $name is not set.' 464 fi 465 | 3# 4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 447 unchanged lines hidden (view full) --- 458run_rc_command() 459{ 460 _return=0 461 rc_arg=$1 462 if [ -z "$name" ]; then 463 err 3 'run_rc_command: $name is not set.' 464 fi 465 |
466 # Don't repeat the first argument when passing additional command- 467 # line arguments to the command subroutines. 468 # 469 shift 1 470 rc_extra_args="$*" 471 |
|
466 _rc_prefix= 467 case "$rc_arg" in 468 fast*) # "fast" prefix; don't check pid 469 rc_arg=${rc_arg#fast} 470 rc_fast=yes 471 ;; 472 force*) # "force prefix; always run 473 rc_force=yes --- 77 unchanged lines hidden (view full) --- 551 eval _cmd=\$${rc_arg}_cmd _precmd=\$${rc_arg}_precmd \ 552 _postcmd=\$${rc_arg}_postcmd 553 if [ -n "$_cmd" ]; then 554 # if the precmd failed and force 555 # isn't set, exit 556 # 557 if [ -n "$_precmd" ]; then 558 debug "run_rc_command: evaluating ${_precmd}()." | 472 _rc_prefix= 473 case "$rc_arg" in 474 fast*) # "fast" prefix; don't check pid 475 rc_arg=${rc_arg#fast} 476 rc_fast=yes 477 ;; 478 force*) # "force prefix; always run 479 rc_force=yes --- 77 unchanged lines hidden (view full) --- 557 eval _cmd=\$${rc_arg}_cmd _precmd=\$${rc_arg}_precmd \ 558 _postcmd=\$${rc_arg}_postcmd 559 if [ -n "$_cmd" ]; then 560 # if the precmd failed and force 561 # isn't set, exit 562 # 563 if [ -n "$_precmd" ]; then 564 debug "run_rc_command: evaluating ${_precmd}()." |
559 eval $_precmd | 565 eval $_precmd $rc_extra_args |
560 _return=$? 561 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 562 return 1 563 fi 564 565 if [ -n "$_cmd" ]; then 566 debug "run_rc_command: evaluating ${_cmd}()." | 566 _return=$? 567 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 568 return 1 569 fi 570 571 if [ -n "$_cmd" ]; then 572 debug "run_rc_command: evaluating ${_cmd}()." |
567 eval $_cmd | 573 eval $_cmd $rc_extra_args |
568 _return=$? 569 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 570 return 1 571 fi 572 573 if [ -n "$_postcmd" ]; then 574 debug "run_rc_command: evaluating ${_postcmd}()." | 574 _return=$? 575 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 576 return 1 577 fi 578 579 if [ -n "$_postcmd" ]; then 580 debug "run_rc_command: evaluating ${_postcmd}()." |
575 eval $_postcmd | 581 eval $_postcmd $rc_extra_args |
576 _return=$? 577 fi 578 return $_return 579 fi 580 581 case "$rc_arg" in # default operations... 582 583 status) --- 162 unchanged lines hidden (view full) --- 746 if [ -n "$_postcmd" ]; then 747 eval $_postcmd 748 _return=$? 749 fi 750 ;; 751 752 restart) 753 if [ -n "$_precmd" ]; then | 582 _return=$? 583 fi 584 return $_return 585 fi 586 587 case "$rc_arg" in # default operations... 588 589 status) --- 162 unchanged lines hidden (view full) --- 752 if [ -n "$_postcmd" ]; then 753 eval $_postcmd 754 _return=$? 755 fi 756 ;; 757 758 restart) 759 if [ -n "$_precmd" ]; then |
754 eval $_precmd | 760 eval $_precmd $rc_extra_args |
755 _return=$? 756 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 757 return 1 758 fi 759 # prevent restart being called more 760 # than once by any given script 761 # 762 if ${_rc_restart_done:-false}; then 763 return 0 764 fi 765 _rc_restart_done=true 766 | 761 _return=$? 762 [ $_return -ne 0 ] && [ -z "$rc_force" ] && 763 return 1 764 fi 765 # prevent restart being called more 766 # than once by any given script 767 # 768 if ${_rc_restart_done:-false}; then 769 return 0 770 fi 771 _rc_restart_done=true 772 |
767 ( $0 ${_rc_prefix}stop ) 768 $0 ${_rc_prefix}start | 773 ( $0 ${_rc_prefix}stop $rc_extra_args ) 774 $0 ${_rc_prefix}start $rc_extra_args |
769 770 if [ -n "$_postcmd" ]; then | 775 776 if [ -n "$_postcmd" ]; then |
771 eval $_postcmd | 777 eval $_postcmd $rc_extra_args |
772 _return=$? 773 fi 774 ;; 775 776 poll) 777 if [ -n "$rc_pid" ]; then 778 wait_for_pids $rc_pid 779 fi --- 515 unchanged lines hidden --- | 778 _return=$? 779 fi 780 ;; 781 782 poll) 783 if [ -n "$rc_pid" ]; then 784 wait_for_pids $rc_pid 785 fi --- 515 unchanged lines hidden --- |