add --nocron, for not installing default cronjob.

This commit is contained in:
neil 2016-06-24 22:27:22 +08:00
parent 2ce87fe264
commit c8e9a31ee5

39
acme.sh
View File

@ -2156,20 +2156,25 @@ _initconf() {
fi fi
} }
# nocron
_precheck() { _precheck() {
_nocron="$1"
if ! _exists "curl" && ! _exists "wget"; then if ! _exists "curl" && ! _exists "wget"; then
_err "Please install curl or wget first, we need to access http resources." _err "Please install curl or wget first, we need to access http resources."
return 1 return 1
fi fi
if ! _exists "crontab" ; then if [ -z "$_nocron" ] ; then
_err "It is recommended to install crontab first. try to install 'cron, crontab, crontabs or vixie-cron'." if ! _exists "crontab" ; then
_err "We need to set cron job to renew the certs automatically." _err "It is recommended to install crontab first. try to install 'cron, crontab, crontabs or vixie-cron'."
_err "Otherwise, your certs will not be able to be renewed automatically." _err "We need to set cron job to renew the certs automatically."
if [ -z "$FORCE" ] ; then _err "Otherwise, your certs will not be able to be renewed automatically."
_err "Please add '--force' and try install again to go without crontab." if [ -z "$FORCE" ] ; then
_err "./$PROJECT_ENTRY --install --force" _err "Please add '--force' and try install again to go without crontab."
return 1 _err "./$PROJECT_ENTRY --install --force"
return 1
fi
fi fi
fi fi
@ -2243,14 +2248,15 @@ _installalias() {
} }
# nocron
install() { install() {
_nocron="$1"
if ! _initpath ; then if ! _initpath ; then
_err "Install failed." _err "Install failed."
return 1 return 1
fi fi
if ! _precheck ; then if ! _precheck "$_nocron" ; then
_err "Pre-check failed, can not install." _err "Pre-check failed, can not install."
return 1 return 1
fi fi
@ -2313,7 +2319,9 @@ install() {
_saveaccountconf "ACCOUNT_KEY_PATH" "$ACCOUNT_KEY_PATH" _saveaccountconf "ACCOUNT_KEY_PATH" "$ACCOUNT_KEY_PATH"
fi fi
installcronjob if [ -z "$_nocron" ] ; then
installcronjob
fi
if [ -z "$NO_DETECT_SH" ] ; then if [ -z "$NO_DETECT_SH" ] ; then
#Modify shebang #Modify shebang
@ -2429,8 +2437,9 @@ Parameters:
--httpport Specifies the standalone listening port. Only valid if the server is behind a reverse proxy or load balancer. --httpport Specifies the standalone listening port. Only valid if the server is behind a reverse proxy or load balancer.
--tlsport Specifies the standalone tls listening port. Only valid if the server is behind a reverse proxy or load balancer. --tlsport Specifies the standalone tls listening port. Only valid if the server is behind a reverse proxy or load balancer.
--listraw Only used for '--list' command, list the certs in raw format. --listraw Only used for '--list' command, list the certs in raw format.
--stopRenewOnError, -se Only valid for '--renewall' command. Stop to renew all if one cert has error in renewal. --stopRenewOnError, -se Only valid for '--renewall' command. Stop if one cert has error in renewal.
--insecure Do not check the server certificate, in some devices, the api server's certificate may not be trusted. --insecure Do not check the server certificate, in some devices, the api server's certificate may not be trusted.
--nocron Only valid for `--install` command, which means: do not install the default cron job. In this case, the certs will not be renewed automatically.
" "
} }
@ -2485,6 +2494,7 @@ _process() {
_listraw="" _listraw=""
_stopRenewOnError="" _stopRenewOnError=""
_insecure="" _insecure=""
_nocron=""
while [ ${#} -gt 0 ] ; do while [ ${#} -gt 0 ] ; do
case "${1}" in case "${1}" in
@ -2722,6 +2732,9 @@ _process() {
_insecure="1" _insecure="1"
Le_Insecure="$_insecure" Le_Insecure="$_insecure"
;; ;;
--nocron)
_nocron="1"
;;
*) *)
_err "Unknown parameter : $1" _err "Unknown parameter : $1"
return 1 return 1
@ -2733,7 +2746,7 @@ _process() {
case "${_CMD}" in case "${_CMD}" in
install) install ;; install) install "$_nocron" ;;
uninstall) uninstall ;; uninstall) uninstall ;;
issue) issue)
issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_certpath" "$_keypath" "$_capath" "$_reloadcmd" "$_fullchainpath" issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_certpath" "$_keypath" "$_capath" "$_reloadcmd" "$_fullchainpath"