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
90100aa1
Commit
90100aa1
authored
Aug 10, 2017
by
neil
Committed by
GitHub
Aug 10, 2017
Browse files
Merge pull request #967 from Neilpang/dev
support fcrontab, fix
https://github.com/Neilpang/acme.sh/issues/966
parents
50d238b6
415f375c
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
90100aa1
...
@@ -4417,15 +4417,19 @@ _installcert() {
...
@@ -4417,15 +4417,19 @@ _installcert() {
installcronjob
()
{
installcronjob
()
{
_c_home
=
"
$1
"
_c_home
=
"
$1
"
_initpath
_initpath
if
!
_exists
"crontab"
;
then
_CRONTAB
=
"crontab"
_err
"crontab doesn't exist, so, we can not install cron jobs."
if
!
_exists
"
$_CRONTAB
"
&&
_exists
"fcrontab"
;
then
_CRONTAB
=
"fcrontab"
fi
if
!
_exists
"
$_CRONTAB
"
;
then
_err
"crontab/fcrontab doesn't exist, so, we can not install cron jobs."
_err
"All your certs will not be renewed automatically."
_err
"All your certs will not be renewed automatically."
_err
"You must add your own cron job to call '
$PROJECT_ENTRY
--cron' everyday."
_err
"You must add your own cron job to call '
$PROJECT_ENTRY
--cron' everyday."
return
1
return
1
fi
fi
_info
"Installing cron job"
_info
"Installing cron job"
if
!
crontab
-l
|
grep
"
$PROJECT_ENTRY
--cron"
;
then
if
!
$_CRONTAB
-l
|
grep
"
$PROJECT_ENTRY
--cron"
;
then
if
[
-f
"
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
]
;
then
if
[
-f
"
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
]
;
then
lesh
=
"
\"
$LE_WORKING_DIR
\"
/
$PROJECT_ENTRY
"
lesh
=
"
\"
$LE_WORKING_DIR
\"
/
$PROJECT_ENTRY
"
else
else
...
@@ -4439,15 +4443,15 @@ installcronjob() {
...
@@ -4439,15 +4443,15 @@ installcronjob() {
_t
=
$(
_time
)
_t
=
$(
_time
)
random_minute
=
$(
_math
$_t
% 60
)
random_minute
=
$(
_math
$_t
% 60
)
if
_exists
uname
&&
uname
-a
|
grep
SunOS
>
/dev/null
;
then
if
_exists
uname
&&
uname
-a
|
grep
SunOS
>
/dev/null
;
then
crontab
-l
|
{
$_CRONTAB
-l
|
{
cat
cat
echo
"
$random_minute
0 * * *
$lesh
--cron --home
\"
$LE_WORKING_DIR
\"
$_c_entry
> /dev/null"
echo
"
$random_minute
0 * * *
$lesh
--cron --home
\"
$LE_WORKING_DIR
\"
$_c_entry
> /dev/null"
}
|
crontab
--
}
|
$_CRONTAB
--
else
else
crontab
-l
|
{
$_CRONTAB
-l
|
{
cat
cat
echo
"
$random_minute
0 * * *
$lesh
--cron --home
\"
$LE_WORKING_DIR
\"
$_c_entry
> /dev/null"
echo
"
$random_minute
0 * * *
$lesh
--cron --home
\"
$LE_WORKING_DIR
\"
$_c_entry
> /dev/null"
}
|
crontab
-
}
|
$_CRONTAB
-
fi
fi
fi
fi
if
[
"
$?
"
!=
"0"
]
;
then
if
[
"
$?
"
!=
"0"
]
;
then
...
@@ -4459,16 +4463,21 @@ installcronjob() {
...
@@ -4459,16 +4463,21 @@ installcronjob() {
}
}
uninstallcronjob
()
{
uninstallcronjob
()
{
if
!
_exists
"crontab"
;
then
_CRONTAB
=
"crontab"
if
!
_exists
"
$_CRONTAB
"
&&
_exists
"fcrontab"
;
then
_CRONTAB
=
"fcrontab"
fi
if
!
_exists
"
$_CRONTAB
"
;
then
return
return
fi
fi
_info
"Removing cron job"
_info
"Removing cron job"
cr
=
"
$(
crontab
-l
|
grep
"
$PROJECT_ENTRY
--cron"
)
"
cr
=
"
$(
$_CRONTAB
-l
|
grep
"
$PROJECT_ENTRY
--cron"
)
"
if
[
"
$cr
"
]
;
then
if
[
"
$cr
"
]
;
then
if
_exists
uname
&&
uname
-a
|
grep
solaris
>
/dev/null
;
then
if
_exists
uname
&&
uname
-a
|
grep
solaris
>
/dev/null
;
then
crontab
-l
|
sed
"/
$PROJECT_ENTRY
--cron/d"
|
crontab
--
$_CRONTAB
-l
|
sed
"/
$PROJECT_ENTRY
--cron/d"
|
$_CRONTAB
--
else
else
crontab
-l
|
sed
"/
$PROJECT_ENTRY
--cron/d"
|
crontab
-
$_CRONTAB
-l
|
sed
"/
$PROJECT_ENTRY
--cron/d"
|
$_CRONTAB
-
fi
fi
LE_WORKING_DIR
=
"
$(
echo
"
$cr
"
|
cut
-d
' '
-f
9 |
tr
-d
'"'
)
"
LE_WORKING_DIR
=
"
$(
echo
"
$cr
"
|
cut
-d
' '
-f
9 |
tr
-d
'"'
)
"
_info LE_WORKING_DIR
"
$LE_WORKING_DIR
"
_info LE_WORKING_DIR
"
$LE_WORKING_DIR
"
...
@@ -4745,7 +4754,7 @@ _precheck() {
...
@@ -4745,7 +4754,7 @@ _precheck() {
fi
fi
if
[
-z
"
$_nocron
"
]
;
then
if
[
-z
"
$_nocron
"
]
;
then
if
!
_exists
"crontab"
;
then
if
!
_exists
"crontab"
&&
!
_exists
"fcrontab"
;
then
_err
"It is recommended to install crontab first. try to install 'cron, crontab, crontabs or vixie-cron'."
_err
"It is recommended to install crontab first. try to install 'cron, crontab, crontabs or vixie-cron'."
_err
"We need to set cron job to renew the certs automatically."
_err
"We need to set cron job to renew the certs automatically."
_err
"Otherwise, your certs will not be able to be renewed automatically."
_err
"Otherwise, your certs will not be able to be renewed automatically."
...
...
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