标签:lease $0 绿色 大量 void request oid graph 设置
functions这个脚本是给/etc/init.d里边的文件使用的。提供了一些基础的功能,看看里边究竟有些什么。首先会设置umask,path,还有语言环境,然后会设置success,failure,warning,normal几种情况下的字体颜色。下面再看看提供的重要方法:
checkpid:检查是否已存在pid,如果有一个存在,返回0(通过查看/proc目录)
daemon:启动某个服务。/etc/init.d目录部分脚本的start使用到这个
killproc:杀死某个进程。/etc/init.d目录部分脚本的stop使用到这个
pidfileofproc:寻找某个进程的pid
pidofproc:类似上面的,只是还查找了pidof命令
status:返回一个服务的状态
echo_success,echo_failure,echo_passed,echo_warning分别输出各类信息
success,failure,passed,warning分别记录日志并调用相应的方法
action:打印某个信息并执行给定的命令,它会根据命令执行的结果来调用 success,failure方法
strstr:判断$1是否含有$2
confirm:显示 "Start service $1 (Y)es/(N)o/(C)ontinue? [Y]"的提示信息,并返回选择结果
详细分析:
# -*-Shell-script-*- # # functions This file contains functions to be used by most or all # 注释 :该脚本几乎被 /etc/init.d/ 下的所有脚本所调用,因为它包含了大量的 # shell scripts in the /etc/init.d directory. # 的基础函数。同时也被 /etc/rc.d/rc.sysinit ,例如 success、action、failure 等函数 #
TEXTDOMAIN=initscripts # 设置 TEXTDOMAIN 变量
#某些系统使用 LC_MESSAGES shell 变量所指定的消息类型. 其他一些系统根据
shell 变量 TEXTDOMAIN 的值来创建消息类型的名称, 可能还会加上后缀‘.mo‘. 如果
你使用 TEXTDOMAIN 变量, 你可能需要设置变量 TEXTDOMAINDIR 指向消息类型文件所
在的位置. 还有某些系统以这种形式两个变量都使用: TEXTDOMAINDIR/LC_MESSAGES
/Lc_Messages/TEXTDOMAIN.mo.
########################################################################################################################
umask 022
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" # 默认为 /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
export PATH # 导出为环境变量
[ -z "${COLUMNS:-}" ] && COLUMNS=80 # 如果 COLUMNS 变量的值为空,则设置为 80 (列)
[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="/sbin/consoletype
" # 如果 CONSOLETYPE 为空则设置 CONSOLETYPE 为 /sbin/consoletype 命令返回的值
#######################################################################################################
if [ -f /etc/sysconfig/i18n -a -z "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 13: {NOLOCALE:-}&?quot; ] ; then …CONSOLETYPE" != "pty" ]; then # 如果当前 console 类型不是 pty(远程登录),而是 vt 或者 serial ,则
case "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 9: {LANG:-}&?quot; in # 根据 L…LC_MESSAGES" ] && export LC_MESSAGES # 且如果 LC_MESSAGES 不为空,则直接导出 LC_MESSAGES
export LANG
fi
fi
#######################*******************************###################
case语句 :它能够把变量的内容与多个模板进行匹配,再根据成功匹配的模板去决定应该执行哪部分代码。
使用格式:
case 匹配母板 in
模板1 [ | 模板2 ] … ) 语句组 ;;
模板3 [ | 模板4 ] … ) 语句组 ;;
esac
case语句的匹配是从上往下地匹配顺序。因此,case语句编写的原则是从上往下,模板从特殊到普通。在C语言里,case语句中有default模板,而在shell程序设计中,可能将模板写成*,就可以完成相同的功能。
case语句的模板支持匹配
匹配以n开头的所有情况: n*
匹配yes的所有字母大小不同的情况: [yY][eE][sS]
但不支持{}匹配,因为模板可以使用 | 就可以达到目的。
例程:
#!/bin/sh
echo "Please input "yes" or "no""
read var
case "$var" in
[yY][eE][sS] ) echo "Your input is YES" ;;
[nN][oO] ) echo "Your input is YES" ;;
esac
exit 0
######################################################
######################################################
if [ -z "${BOOTUP:-}" ]; then # 首先如果 BOOTUP 变量为空,则
if [ -f /etc/sysconfig/init ]; then # 如果存在 /etc/sysconfig/init 文件,执行 /etc/sysconfig/init 文件
. /etc/sysconfig/init
else # 否则我们就手工设置
BOOTUP=color # 第一设置 BOOTUP 变量,默认就是 color
RES_COL=60 # 第二设置设置在屏幕的第几列输出后面的 "[ xxx ]" ,默认是第 60 列
MOVE_TO_COL="echo -en \033[${RES_COL}G" # MOVE_TO_COL 是用于打印 "OK" 或者 "FAILED" ,或者 "PASSED" ,或者 "WARNING" 之前的部分,不含 "["
SETCOLOR_SUCCESS="echo -en \033[1;32m" # SETCOLOR_SUCCESS 设置后面的字体都为绿色
SETCOLOR_FAILURE="echo -en \033[1;31m" # SETCOLOR_FAILURE 设置后面将要输出的字体都为红色
SETCOLOR_WARNING="echo -en \033[1;33m" # SETCOLOR_WARNING 设置后面将要输出的字体都为黄色
SETCOLOR_NORMAL="echo -en \033[0;39m" # SETCOLOR_NORMAL 设置后面输出的字体都为白色(默认)
LOGLEVEL=1
fi
if [ "$CONSOLETYPE" = "serial" ]; then # 如果是通过串口登录的,则全部取消彩色输出
BOOTUP=serial
MOVE_TO_COL=
SETCOLOR_SUCCESS=
SETCOLOR_FAILURE=
SETCOLOR_WARNING=
SETCOLOR_NORMAL=
fi
fi
######################################################
######################################################
if [ "${BOOTUP:-}" != "verbose" ]; then # 如果 BOOTUP 变量的值不为 verbose ,则
INITLOG_ARGS="-q" # 把 INITLOG_ARGS 的值设置为 -q (安静模式)
else # 否则
INITLOG_ARGS= # 把 INITLOG_ARGS 的值请空
fi
#################################################################################################
checkpid() { # 如果有任意一个存在,则返回 0;
local i #局部变量定义
for i in KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 13: * ; do
[ -d &?quot;/proc/i" ] && return 0
done
return 1 # 如果给出的参数全部不存在对应的目录,则返回 1
}
#####################################################################################################
daemon() {
local gotbase= force=
local base= user= nice= bg= pid=
nicelevel=0
while [ "$1" != "KaTeX parse error: Expected ‘}‘, got ‘#‘ at position 3: {1#?#[-+]}" ];…"$0: Usage: daemon [+/-nicelevel] {program}" # 也可以指定 nice 值
return 1;;
--check)
base=$2
gotbase="yes"
shift 2
;;
--check=?)
base=KaTeX parse error: Expected ‘}‘, got ‘#‘ at position 3: {1#?--check=}
gotba…{1#--user=}
shift
;;
--force)
force="force" # --force 表示强制运行
shift
;;
[-+][0-9])
nice="nice -n $1" # 如果 daemon 的第一个参数是数字,则认为是 nice 值
shift
;;
*) echo $"$0: Usage: daemon [+/-nicelevel] {program}"
return 1;;
esac
done
[ -z "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 8: gotbase&?quot; ] &&a…{1##*/}
if [ -f /var/run/KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 20: …e}.pid ]; then #? 如果 /var/run 下存…{base}.pid # 从该 pid 文件每次读取一行,送给变量 line 。注意 pid 文件可能有多行,且不一定都是数字
for p in KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 11: line ; do #? 对于 line 变量的每个 …{p//[0-9]/}" -a -d "/proc/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot; ] &&a…pid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot; # 如果 p 全部…p/ 目录,则认为该数字是一个 pid ,把它加入到 pid 变量
done # 到最后 pid 变量的值可能是有多个由空格分隔的数字组成
fi
[ -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 8: {pid:-}&?quot; -a -z &qu…{force:-}" ] && return # 如果 pid 变量最终为空,则 force 变量为空(不强制启动),则返回
ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1 # ulimit 是控制由该 shell 启动的进程能够使用的资源,-S 是 soft control 的意思,-c 是指最大的 core
[ -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 10: NICELEVEL&?quot; ] &&a…NICELEVEL" # 注意,这里的 nice 赋值是用 nice -n <value> 的格式,因为 nice 本身可以启动命令,用这个格式较方便
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 11: {BOOTUP:-}&?quot; = "v…LSB" ] && echo -n " $base"
if [ -z "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: user&?quot; ]; then #…nice initlog KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 17: …NITLOG_ARGS -c &?quot;" # 执行 nice -n <nice_value> initlog -q -c "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: *&?quot;
else # 如…nice initlog KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 17: …NITLOG_ARGS -c &?quot;runuser -s…user -c "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 9: *\"&?quot; # 执行 nice…"
fi
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: ?&?quot; -eq 0 ] &…"KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 13: base startup&?quot; || failur…"$base startup" # 如果上面的命令成功,则显示一个绿色的 [ OK ] ,否则显示 [ FAILURE ]
}
################################################################################################
killproc() {
RC=0 # RC 是最终返回的值,初始化为 0
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 1: #?" -eq 0 ];…"Usage: killproc {program} [signal]"
return 1
fi
notset=0 # noset 是用于检查用户是否指定了 kill 要使用的信号
if [ -n "$2" ]; then # 如果 $2 不为空,则表示用户有设定信号,则
killlevel=$2 # 把 $2 的值赋予 killlevel 变量
else # 否则
notset=1 # notset 变量的值为 1,同时 killlevel 为 ‘-9‘ (KILL 信号)
killlevel="-9"
fi
base=${1##*/} # basename 就是得出服务的名称
pid= # 把 pid 变量的值清空。注意,不是指 pid 变量的值等于下面脚本的执行结果,要看清楚
if [ -f /var/run/KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 20: …e}.pid ]; then #? 下面和上面的 daemon …{base}.pid
for p in KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 16: line ; do
[ -z &?quot;{p//[0-9]/}" -a -d "/proc/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot; ] &&a…pid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot;
done
fi
i…pid" ]; then # 不过和 daemon 不同的是,一旦 pid 为空不会直接 return 而是尝试用 pid 命令再次查找
pid=pidof -o $$ -o $PPID -o %PPID -x $1 || \ # -o 是用于忽略某个 pid ,-o $$ 是忽略当前 shell 的 pid、-o $PPID 是忽略 shell 的 pid pidof -o $$ -o $PPID -o %PPID -x $base
# -o % PPID 是忽略 pidof 命令的父进程,要查询的进程是 $1 (fullpath) 或者 $base
fi
if [ -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 8: {pid:-}&?quot; ] ; then …BOOTUP" = "verbose" -a -z "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 4: LSB&?quot; ] &&a…base " # 且 BOOTUP 的值为 verbose ,且 LSB 变量不为空,则打印一个服务名
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: notset&?quot; -eq "…pid 2>&1; then # 调用 checkpid $pid 检查是否在 /proc/ 下存在进程目录,如果有
kill -TERM KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: pid &?gt;/dev/null 2&…pid
usleep 100000 # usleep 和 sleep 一样,不过单位是百万分之 1 秒。这里休眠 1 秒
if checkpid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: pid &?amp;& sleep…pid 还是查到有 /proc/<pid>/ 目录存在,则表示还没有杀死,继续等待 1 秒
checkpid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: pid &?amp;& sleep…pid ; then # 如果还是没有杀死,则用 KILL 信号
kill -KILL KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: pid &?gt;/dev/null 2&…pid # 再次检查 pid 目录
RC=KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 3: ? #? 并把结果返回给 RC ,这就…RC" -eq 0 ] && failure KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;base shutdown" || success KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;base shutdown" # 如果 RC 的值为 0,则表示 kill -9 没有杀死了进程,则调用 failure 函数,否则调用 success
RC=((!RC))
else # 这个 else 是针对 if [ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: notset&?quot; -eq "…pid; then # 如果检查到进程存在,则
kill killlevelpid >/dev/null 2>&1 # 执行 kill 命令,但使用指定的信号 killlevelRC=? # 并把状态值返回给变量 RC
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 3: RC&?quot; -eq 0 ] &…"basekilllevel" || failure KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;base KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 10: killlevel&?quot; # 如果 RC 为…{pid:-}" ] 的,也就是说没有 pid 文件,pidof 命令也没有找到 pid ,则
failure KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;base shutdown" # 调用 failure 函数,表示停止服务失败
RC=1 # 同时 RC 的值为 1
fi
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: notset&?quot; = "1…base.pid # 自动删除 /var/run 下的 pid 文件
fi
return $RC # 并把 RC 作为 exit status 返回
}
root 2635 1 0 12:25 ? 00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
Reloading configuration: [ OK ]
root 2635 1 0 12:25 ? 00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
root 3927 3412 0 16:43 pts/0 00:00:00 grep xinetd
#可以看到 pid 在 reload 后并没有变
##################################################################################################
pidfileofproc() {
local base=${1##*/}
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 1: #?" = 0 ] ; …"Usage: pidfileofproc {program}"
return 1
fi
if [ -f /var/run/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 47: …pid=
read line &?lt; /var/run/base.pid
for p in KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 16: line ; do
[ -z &?quot;{p//[0-9]/}" -a -d /proc/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: p ] &?amp;& pid=&…pid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot;
done
if […pid" ]; then
echo $pid
return 0
fi
fi
}
#################################################################################################
pidofproc() {
base=${1##*/}
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 1: #?" = 0 ]; t…"Usage: pidofproc {program}"
return 1
fi
if [ -f /var/run/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 46: …pid=
read line &?lt; /var/run/base.pid
for p in KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 16: line ; do
[ -z &?quot;{p//[0-9]/}" -a -d /proc/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 5: p ] &?amp;& pid=&…pid KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: p&?quot;
done
if […pid" ]; then
echo pidreturn0fifipidof−o−oPPID -o % PPID -x $1 ||
pidof -o $−oPPID -o % PPID -x KaTeX parse error: Expected ‘EOF‘, got ‘}‘ at position 6: base
}?
##############…{1##*/}
local pid
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 1: #?" = 0 ] ; …"Usage: status {program}"
return 1
fi
pid=pidof -o $$ -o $PPID -o %PPID -x $1 || \ pidof -o $$ -o $PPID -o %PPID -x ${base}
if [ -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 4: pid&?quot; ]; then #…"base(pidpid) is running..." # 则打印 "xxx (pid nnn) is running " ,
return 0 # 并返回 0
fi
if [ -f /var/run/KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 30: … then
read pid &?lt; /var/run/{base}.pid
if [ -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 4: pid&?quot; ]; then #…"${base} dead but pid file exists" # 打印 "xxx dead but pid file exists",
return 1 # 并返回 1
fi
fi
if [ -f /var/lock/subsys/KaTeX parse error: Expected ‘EOF‘, got ‘#‘ at position 16: {base} ]; then #? 如果在 /var/lock/…"KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 30: …t subsys locked&?quot; # 打印 “xxx…"${base} is stopped" # 如果 pidof 命令、pidf 文件都没有找到 pid ,且没有别锁,则打印 “xxx is stopped”
return 3 # 并返回 3
}
###########################################################################################
echo_success() { # 下面是 echo_success 部分
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…MOVE_TO_COL # 首先是打印 “[” 之前的空格
echo -n "[ " # 然后打印 "["
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…SETCOLOR_SUCCESS # 设置字体为红色
echo -n KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;OK" #…BOOTUP" = "color" ] && $SETCOLOR_NORMAL # 返回字体为白色
echo -n " ]" # 打印 "]"
echo -ne "\r" # 换行。
return 0 # 返回 0,其他一律返回 1
echo_failure() {
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…MOVE_TO_COL
echo -n "["
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…SETCOLOR_FAILURE
echo -n KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;FAILED&quo…BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
echo_passed() {
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…MOVE_TO_COL
echo -n "["
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…SETCOLOR_WARNING
echo -n KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;PASSED&quo…BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
echo_warning() {
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…MOVE_TO_COL
echo -n "["
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; = "c…SETCOLOR_WARNING
echo -n KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;WARNING&qu…BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
##################################################################################################
update_boot_stage() {
if [ "$GRAPHICAL" = "yes" -a -x /usr/bin/rhgb-client ]; then
/usr/bin/rhgb-client --update="$1"
fi
return 0
}
################################################################################################
success() { # success 函数除了打印 [ xxx ] 之外,还会使用 initlog 记录信息
if [ -z "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 15: {IN_INITLOG:-}&?quot; ]; then
i…INITLOG_ARGS -n $0 -s "$1" -e 1 # -n 是 --name 的意思,-s 是 --string ,-e 是 --event ,1 表示完全成功
else
trap "" SIGPIPE
echo "KaTeX parse error: Can‘t use function ‘$‘ in math mode at position 17: …NITLOG_ARGS -n $?0 -s \"$1\…BOOTUP" != "verbose" -a -z "$LSB" ] && echo_success
return 0
}
failure() {
rc=KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 11: ?
if [ -z &?quot;{IN_INITLOG:-}" ]; then
initlog KaTeX parse error: Can‘t use function ‘$‘ in math mode at position 17: …NITLOG_ARGS -n $?0 -s "$1&q…INITLOG_ARGS -n $0 -s "$1" -e 2" >&21
trap - SIGPIPE
fi
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; != "…LSB" ] && echo_failure
[ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes
return $rc
}
passed() {
rc=KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 11: ?
if [ -z &?quot;{IN_INITLOG:-}" ]; then
initlog KaTeX parse error: Can‘t use function ‘$‘ in math mode at position 17: …NITLOG_ARGS -n $?0 -s "$1&q…INITLOG_ARGS -n $0 -s "$1" -e 1" >&21
trap - SIGPIPE
fi
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; != "…LSB" ] && echo_passed
return $rc
}
warning() {
rc=KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 11: ?
if [ -z &?quot;{IN_INITLOG:-}" ]; then
initlog KaTeX parse error: Can‘t use function ‘$‘ in math mode at position 17: …NITLOG_ARGS -n $?0 -s "$1&q…INITLOG_ARGS -n $0 -s "$1" -e 1" >&21
trap - SIGPIPE
fi
[ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: BOOTUP&?quot; != "…LSB" ] && echo_warning
return $rc
}
####################################################################################################
tion() {
STRING=$1
echo -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 8: STRING &?quot;
if [ &quo…{RHGB_STARTED}" != "" -a -w /etc/rhgb/temp/rhgb-console ]; then
echo -n "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 8: STRING &?quot; > /etc…INITLOG_ARGS -c "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 2: *&?quot; &&…"KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: STRING&?quot; || failur…"KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: STRING&?quot;
rc=?
echo
if [ "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 15: {RHGB_STARTED}&?quot; != "…rc" = "0" ]; then
echo_success > /etc/rhgb/temp/rhgb-console
else
echo_failed > /etc/rhgb/temp/rhgb-console
[ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes
fi
echo
fi
return $rc
}
###############################################################################################
() {
[ "${1#$2}" = "$1" ] && return 1
return 0
}
#############################################################################################
nfirm() {
[ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes
while : ; do
echo -n KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;Start serv…"yY" "KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 7: answer&?quot; || [ &quo…answer" = "" ] ; then # 如果 answer 变量是 y 或者 Y 则
return 0 # 返回 0(但未真正启动)
elif strstr KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;cC" &…answer" ; then # 如果 answer 是 c 或者 C ,则
rm -f /var/run/confirm # 删除 /var/run/confirm 文件
[ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=no
return 2 # 返回 2
elif strstr KaTeX parse error: Expected ‘EOF‘, got ‘&‘ at position 1: &?quot;nN" &…answer" ; then # 如果 answer 是 n 或者 N,则
return 1 # 直接返回 1
fi
done
}
作者:An
链接:https://hacpai.com/article/1389683304827
来源:黑客派
协议:CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/
Shell公共函数:/etc/init.d/functions详解 action
标签:lease $0 绿色 大量 void request oid graph 设置
原文地址:https://www.cnblogs.com/zyh9900010/p/11703268.html