Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions httpsok.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh

# WIKI: https://httpsok.com/doc/
# This script only supports bash, do not support posix sh.
Expand Down Expand Up @@ -191,7 +191,11 @@ _init_params() {
# user can setting
if [ -z "$NGINX_CONFIG" ]; then
# Use a running nginx first
NGINX_CONFIG=$(ps -eo pid,cmd | grep nginx | grep master | grep '\-c' | awk -F '-c' '{print $2}' | sed 's/ //g')
if ps -eo pid,cmd 2>&1;then
NGINX_CONFIG=$(ps -eo pid,cmd | grep nginx | grep master | grep '\-c' | awk -F '-c' '{print $2}' | sed 's/ //g')
else
NGINX_CONFIG=$(ps -e| grep nginx | grep master | grep '\-c' | awk -F '-c' '{print $2}' | sed 's/ //g')
fi
fi

# fix the NGINX_CONFIG equals nginx.conf bug
Expand Down Expand Up @@ -875,7 +879,7 @@ _uninstall() {
showWelcome
echo "If your need install httpsok agian. Please see $HTTPSOK_HOME_URL .

curl -s $SCRIPT_URL | bash -s 'your token'
curl -s $SCRIPT_URL | /bin/sh -s 'your token'

"
}
Expand Down Expand Up @@ -996,4 +1000,4 @@ main() {
if _startswith "$1" '-'; then _process "$@"; else _process --setup "$@"; fi
}

main "$@"
main "$@"