Commit e7b8e77fbba2aae05c9ebbb0c738da2aa4e6fc35
1 parent
ef148b02
Exists in
master
Update ngrokd.init
Showing
1 changed file
with
31 additions
and
2 deletions
Show diff stats
ngrokd.init
@@ -30,7 +30,7 @@ LOGFILE=${ProGramInstallPath}/ngrok.log | @@ -30,7 +30,7 @@ LOGFILE=${ProGramInstallPath}/ngrok.log | ||
30 | SCRIPTNAME=/etc/init.d/${NAME} | 30 | SCRIPTNAME=/etc/init.d/${NAME} |
31 | PID_DIR=/var/run | 31 | PID_DIR=/var/run |
32 | PID_FILE=$PID_DIR/ngrok_clang.pid | 32 | PID_FILE=$PID_DIR/ngrok_clang.pid |
33 | -version="v5.4" | 33 | +version="v5.5" |
34 | manage_port="4446" | 34 | manage_port="4446" |
35 | RET_VAL=0 | 35 | RET_VAL=0 |
36 | 36 | ||
@@ -163,8 +163,37 @@ fun_status(){ | @@ -163,8 +163,37 @@ fun_status(){ | ||
163 | exit 0 | 163 | exit 0 |
164 | fi | 164 | fi |
165 | } | 165 | } |
166 | +check_nano(){ | ||
167 | + nano -V | ||
168 | + #echo $? | ||
169 | + if [[ $? -le 1 ]] ;then | ||
170 | + echo " Run nano success" | ||
171 | + else | ||
172 | + echo " Run nano failed" | ||
173 | + if [ "${OS}" == 'CentOS' ]; then | ||
174 | + echo " Install centos nano ..." | ||
175 | + #yum -y update | ||
176 | + yum -y install nano | ||
177 | + else | ||
178 | + echo " Install debian/ubuntu nano ..." | ||
179 | + apt-get update -y | ||
180 | + apt-get install -y nano | ||
181 | + fi | ||
182 | + fi | ||
183 | + # if [[ ! -d "$result" ]]; then | ||
184 | + # echo "not found" | ||
185 | + # else | ||
186 | + # echo "found" | ||
187 | + # fi | ||
188 | + echo $result | ||
189 | +} | ||
166 | fun_config(){ | 190 | fun_config(){ |
167 | - nano ${CONFIGFILE} | 191 | + check_nano |
192 | + if [ -s ${CONFIGFILE} ]; then | ||
193 | + nano ${CONFIGFILE} | ||
194 | + else | ||
195 | + echo "${ProgramName} configuration file not found!" | ||
196 | + fi | ||
168 | } | 197 | } |
169 | fun_set_ngrok_username(){ | 198 | fun_set_ngrok_username(){ |
170 | userName="" | 199 | userName="" |