From c8e9a31ee5d2ec7622f02dca75221f4d9f9445e4 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 24 Jun 2016 22:27:22 +0800 Subject: [PATCH] add `--nocron`, for not installing default cronjob. --- acme.sh | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/acme.sh b/acme.sh index 6aa7611..ef50f50 100755 --- a/acme.sh +++ b/acme.sh @@ -2156,20 +2156,25 @@ _initconf() { fi } +# nocron _precheck() { + _nocron="$1" + if ! _exists "curl" && ! _exists "wget"; then _err "Please install curl or wget first, we need to access http resources." return 1 fi - if ! _exists "crontab" ; then - _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 "Otherwise, your certs will not be able to be renewed automatically." - if [ -z "$FORCE" ] ; then - _err "Please add '--force' and try install again to go without crontab." - _err "./$PROJECT_ENTRY --install --force" - return 1 + if [ -z "$_nocron" ] ; then + if ! _exists "crontab" ; then + _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 "Otherwise, your certs will not be able to be renewed automatically." + if [ -z "$FORCE" ] ; then + _err "Please add '--force' and try install again to go without crontab." + _err "./$PROJECT_ENTRY --install --force" + return 1 + fi fi fi @@ -2243,14 +2248,15 @@ _installalias() { } +# nocron install() { - + _nocron="$1" if ! _initpath ; then _err "Install failed." return 1 fi - if ! _precheck ; then + if ! _precheck "$_nocron" ; then _err "Pre-check failed, can not install." return 1 fi @@ -2313,7 +2319,9 @@ install() { _saveaccountconf "ACCOUNT_KEY_PATH" "$ACCOUNT_KEY_PATH" fi - installcronjob + if [ -z "$_nocron" ] ; then + installcronjob + fi if [ -z "$NO_DETECT_SH" ] ; then #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. --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. - --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. + --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="" _stopRenewOnError="" _insecure="" + _nocron="" while [ ${#} -gt 0 ] ; do case "${1}" in @@ -2722,6 +2732,9 @@ _process() { _insecure="1" Le_Insecure="$_insecure" ;; + --nocron) + _nocron="1" + ;; *) _err "Unknown parameter : $1" return 1 @@ -2733,7 +2746,7 @@ _process() { case "${_CMD}" in - install) install ;; + install) install "$_nocron" ;; uninstall) uninstall ;; issue) issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_certpath" "$_keypath" "$_capath" "$_reloadcmd" "$_fullchainpath"