Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
edf08da6
Commit
edf08da6
authored
Mar 23, 2016
by
neil
Browse files
compatible for netstat on FreeBSD
parent
50a4ef9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
le.sh
View file @
edf08da6
...
@@ -181,21 +181,28 @@ _sign() {
...
@@ -181,21 +181,28 @@ _sign() {
_ss
()
{
_ss
()
{
_port
=
"
$1
"
_port
=
"
$1
"
if
command
-v
"netstat"
>
/dev/null 2>&1
;
then
if
_exists
"ss"
;
then
_debug
"Using: ss"
ss
-ntpl
|
grep
:
$_port
" "
return
0
fi
if
_exists
"netstat"
;
then
_debug
"Using: netstat"
_debug
"Using: netstat"
if
netstat
-h
2>&1 |
grep
"
\-
p proto"
>
/dev/null
;
then
if
netstat
-h
2>&1 |
grep
"
\-
p proto"
>
/dev/null
;
then
#for windows version netstat tool
#for windows version netstat tool
netstat
-anb
-p
tcp |
grep
"LISTENING"
|
grep
:
$_port
" "
netstat
-anb
-p
tcp |
grep
"LISTENING"
|
grep
:
$_port
" "
else
else
netstat
-ntpl
|
grep
:
$_port
" "
if
netstat
-help
2>&1 |
grep
"-p protocol"
>
/dev/null
;
then
netstat
-an
-p
tcp |
grep
LISTEN |
grep
:
$_port
" "
else
netstat
-ntpl
|
grep
:
$_port
" "
fi
fi
fi
return
0
return
0
fi
fi
if
command
-v
"ss"
>
/dev/null 2>&1
;
then
_debug
"Using: ss"
ss
-ntpl
|
grep
:
$_port
" "
return
0
fi
return
1
return
1
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment