为什么Jetty启动脚本从基本名称中删除[SK] [0-9]?

时间:2015-04-16 01:59:00

标签: shell jetty

我读了Jetty 9启动脚本,发现了这个:

#!/usr/bin/env bash
#
# Startup script for jetty under *nix systems (it works under NT/cygwin too).

##################################################
# Set the name which is used by other variables.
# Defaults to the file name without extension.
##################################################
NAME=$(echo $(basename $0) | sed -e 's/^[SK][0-9]*//' -e 's/\.sh$//')

# To get the service to restart correctly on reboot, uncomment below (3 lines):
# ========================
# chkconfig: 3 99 99
# description: Jetty 9 webserver
# processname: jetty
# ========================

我想知道为什么我们应该从NAME删除S / K和数字。

/search/S2jetty.sh =>码头

有谁可以解释一下?

非常感谢!

1 个答案:

答案 0 :(得分:0)

尝试从当前正在运行的init脚本中获取名称。

/etc/init.d目录中的链接都以S(用于开始)或K(用于终止)和数字(用于控制排序顺序)开头。

该字母+数字组合是服务系统的工件,而不是相关服务名称的一部分,因此正在删除前缀。

相关问题