rc.subr (295949) | rc.subr (298515) |
---|---|
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ | 1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ |
2# $FreeBSD: head/etc/rc.subr 295949 2016-02-24 01:32:12Z araujo $ | 2# $FreeBSD: head/etc/rc.subr 298515 2016-04-23 16:19:34Z lme $ |
3# 4# Copyright (c) 1997-2004 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 --- 828 unchanged lines hidden (view full) --- 839# status Show if ${command} is running, etc. 840# 841# poll Wait for ${command} to exit. 842# 843# rcvar Display what rc.conf variable is used (if any). 844# 845# enabled Return true if the service is enabled. 846# | 3# 4# Copyright (c) 1997-2004 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 --- 828 unchanged lines hidden (view full) --- 839# status Show if ${command} is running, etc. 840# 841# poll Wait for ${command} to exit. 842# 843# rcvar Display what rc.conf variable is used (if any). 844# 845# enabled Return true if the service is enabled. 846# |
847# describe Show the service's description 848# 849# extracommands Show the service's extra commands 850# |
|
847# Variables available to methods, and after run_rc_command() has 848# completed: 849# 850# Variable Purpose 851# -------- ------- 852# rc_arg Argument to command, after fast/force/one processing 853# performed 854# --- 52 unchanged lines hidden (view full) --- 907 rc_arg=${rc_arg#${_rc_prefix}} 908 rc_quiet=yes 909 ;; 910 esac 911 912 eval _override_command=\$${name}_program 913 command=${_override_command:-$command} 914 | 851# Variables available to methods, and after run_rc_command() has 852# completed: 853# 854# Variable Purpose 855# -------- ------- 856# rc_arg Argument to command, after fast/force/one processing 857# performed 858# --- 52 unchanged lines hidden (view full) --- 911 rc_arg=${rc_arg#${_rc_prefix}} 912 rc_quiet=yes 913 ;; 914 esac 915 916 eval _override_command=\$${name}_program 917 command=${_override_command:-$command} 918 |
915 _keywords="start stop restart rcvar enabled $extra_commands" | 919 _keywords="start stop restart rcvar enabled describe extracommands $extra_commands" |
916 rc_pid= 917 _pidcmd= 918 _procname=${procname:-${command}} 919 920 # setup pid check command 921 if [ -n "$_procname" ]; then 922 if [ -n "$pidfile" ]; then 923 _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')' --- 33 unchanged lines hidden (view full) --- 957 fi 958 959 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary 960 961 for _elem in $_keywords; do 962 if [ "$_elem" != "$rc_arg" ]; then 963 continue 964 fi | 920 rc_pid= 921 _pidcmd= 922 _procname=${procname:-${command}} 923 924 # setup pid check command 925 if [ -n "$_procname" ]; then 926 if [ -n "$pidfile" ]; then 927 _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')' --- 33 unchanged lines hidden (view full) --- 961 fi 962 963 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary 964 965 for _elem in $_keywords; do 966 if [ "$_elem" != "$rc_arg" ]; then 967 continue 968 fi |
965 # if ${rcvar} is set, $1 is not "rcvar" | 969 # if ${rcvar} is set, $1 is not "rcvar" and not "describe" |
966 # and ${rc_pid} is not set, then run 967 # checkyesno ${rcvar} 968 # and return if that failed 969 # | 970 # and ${rc_pid} is not set, then run 971 # checkyesno ${rcvar} 972 # and return if that failed 973 # |
970 if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" ] || | 974 if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" \ 975 -a "$rc_arg" != "describe" ] || |
971 [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then 972 if ! checkyesno ${rcvar}; then 973 if [ -n "${rc_quiet}" ]; then 974 return 0 975 fi 976 echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to " 977 echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' " 978 echo "instead of '${rc_arg}'." --- 20 unchanged lines hidden (view full) --- 999 _run_rc_precmd || return 1 1000 _run_rc_doit "$_cmd $rc_extra_args" || return 1 1001 _run_rc_postcmd 1002 return $_return 1003 fi 1004 1005 case "$rc_arg" in # default operations... 1006 | 976 [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then 977 if ! checkyesno ${rcvar}; then 978 if [ -n "${rc_quiet}" ]; then 979 return 0 980 fi 981 echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to " 982 echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' " 983 echo "instead of '${rc_arg}'." --- 20 unchanged lines hidden (view full) --- 1004 _run_rc_precmd || return 1 1005 _run_rc_doit "$_cmd $rc_extra_args" || return 1 1006 _run_rc_postcmd 1007 return $_return 1008 fi 1009 1010 case "$rc_arg" in # default operations... 1011 |
1012 describe) 1013 if [ -n "$desc" ]; then 1014 echo "$desc" 1015 fi 1016 ;; 1017 1018 extracommands) 1019 echo "$extra_commands" 1020 ;; 1021 |
|
1007 status) 1008 _run_rc_precmd || return 1 1009 if [ -n "$rc_pid" ]; then 1010 echo "${name} is running as pid $rc_pid." 1011 else 1012 echo "${name} is not running." 1013 return 1 1014 fi --- 1110 unchanged lines hidden --- | 1022 status) 1023 _run_rc_precmd || return 1 1024 if [ -n "$rc_pid" ]; then 1025 echo "${name} is running as pid $rc_pid." 1026 else 1027 echo "${name} is not running." 1028 return 1 1029 fi --- 1110 unchanged lines hidden --- |