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
63f5d07e
Commit
63f5d07e
authored
Apr 13, 2016
by
neil
Browse files
Merge pull request #133 from Neilpang/nc-timeout
Add nc timeout
parents
fb6d3ab2
233e8a20
Changes
1
Hide whitespace changes
Inline
Side-by-side
le.sh
View file @
63f5d07e
...
...
@@ -618,7 +618,7 @@ _saveaccountconf() {
_startserver
()
{
content
=
"
$1
"
_debug
"startserver:
$$
"
nchelp
=
"
$(
nc
-h
2>&1
)
"
if
echo
"
$nchelp
"
|
grep
"
\-
q[ ,]"
>
/dev/null
;
then
...
...
@@ -646,13 +646,29 @@ _startserver() {
fi
if
[[
"
$?
"
!=
"0"
]]
;
then
_err
"nc listen error."
return
1
exit
1
fi
# done
}
_stopserver
()
{
_stopserver
(){
pid
=
"
$1
"
_debug
"pid"
"
$pid
"
if
[[
-z
"
$pid
"
]]
;
then
return
fi
if
[[
"
$(
ps |
grep
"
$pid
"
)
"
]]
;
then
_debug
"Found proc process, kill it."
kill
-s
9
$pid
>
/dev/null
fi
for
ncid
in
$(
echo
$(
ps |
grep
nc
)
|
cut
-d
" "
-f
1
)
;
do
_debug
"kill
$ncid
"
kill
-s
9
$ncid
>
/dev/null
done
_get
"http://localhost:
$Le_HTTPPort
"
>
/dev/null 2>
$1
}
...
...
@@ -1184,9 +1200,13 @@ issue() {
if
[[
"
$_currentRoot
"
==
"no"
]]
;
then
_info
"Standalone mode server"
_startserver
"
$keyauthorization
"
&
if
[[
"
$?
"
!=
"0"
]]
;
then
return
1
fi
serverproc
=
"
$!
"
sleep
2
_debug serverproc
$serverproc
else
if
[[
-z
"
$wellknown_path
"
]]
;
then
wellknown_path
=
"
$_currentRoot
/.well-known/acme-challenge"
...
...
@@ -1224,7 +1244,20 @@ issue() {
return
1
fi
waittimes
=
0
if
[[
-z
"
$MAX_RETRY_TIMES
"
]]
;
then
MAX_RETRY_TIMES
=
30
fi
while
[[
"1"
]]
;
do
let
"waittimes+=1"
if
[[
"
$waittimes
"
-ge
"
$MAX_RETRY_TIMES
"
]]
;
then
_err
"
$d
:Timeout"
_clearupwebbroot
"
$_currentRoot
"
"
$removelevel
"
"
$token
"
_clearup
return
1
fi
_debug
"sleep 5 secs to verify"
sleep
5
_debug
"checking"
...
...
@@ -1946,14 +1979,13 @@ _process() {
STAGE
=
"1"
;;
--debug
)
if
[[
"
$2
"
==
"-"
*
]]
;
then
if
[[
"
$2
"
==
"-"
*
]]
||
[[
-z
"
$2
"
]]
;
then
DEBUG
=
"1"
else
DEBUG
=
"
$2
"
shift
fi
fi
;;
--webroot
|
-w
)
wvalue
=
"
$2
"
if
[[
-z
"
$_webroot
"
]]
;
then
...
...
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