Commit 5f77e3dcca98f6239574cc1cfb7a5a5c2f724916
Committed by
GitHub
1 parent
3a895b3b
Exists in
master
Update ngrokd.init
修正启动判断问题
Showing
1 changed file
with
4 additions
and
10 deletions
Show diff stats
ngrokd.init
... | ... | @@ -35,7 +35,7 @@ LOGFILE=${ProGramInstallPath}/ngrok.log |
35 | 35 | SCRIPTNAME=/etc/init.d/${NAME} |
36 | 36 | PID_DIR=/var/run |
37 | 37 | PID_FILE=${PID_DIR}/ngrok_clang.pid |
38 | -version="8.1" | |
38 | +version="8.2" | |
39 | 39 | manage_port="4446" |
40 | 40 | RET_VAL=0 |
41 | 41 | |
... | ... | @@ -115,13 +115,9 @@ fun_start() |
115 | 115 | if [ "${arg1}" = "start" ]; then |
116 | 116 | fun_clangcn |
117 | 117 | fi |
118 | - if [ ! -d $PID_DIR ]; then | |
119 | - mkdir -p $PID_DIR || echo "failed creating PID directory ${PID_DIR}"; exit 1 | |
120 | - fi | |
121 | - if [ -f ${PID_FILE} ]; then | |
122 | - read PID < ${PID_FILE} | |
123 | - echo "$NAME (pid $PID) is already running..." | |
124 | - exit 0 | |
118 | + if fun_check_run; then | |
119 | + echo "${NAME} (pid $PID) already running." | |
120 | + return 0 | |
125 | 121 | fi |
126 | 122 | echo -n "Starting ${ProgramName}: " |
127 | 123 | fun_check_port |
... | ... | @@ -129,7 +125,6 @@ fun_start() |
129 | 125 | ${BIN} -domain="$dns" -httpAddr=":$http_port" -httpsAddr=":$https_port" -pass="$pass" -tlsCrt="$srtCRT" -tlsKey="$strKey" -tunnelAddr=":$remote_port"${log_level} > ${LOGFILE} 2>&1 & |
130 | 126 | RETVAL=$? |
131 | 127 | PID=$(ps -ef | grep -v grep | grep -i ${BIN} | awk '{print $2}') |
132 | - echo ${PID} > ${PID_FILE} | |
133 | 128 | if [ -f /etc/rc.d/init.d/functions ]; then |
134 | 129 | [ $RETVAL -eq 0 ] && success |
135 | 130 | else |
... | ... | @@ -388,4 +383,3 @@ case "${arg1}" in |
388 | 383 | ;; |
389 | 384 | esac |
390 | 385 | exit $RET_VAL |
391 | - | ... | ... |