From 3aae1ae3d9aa0cef72bce70bc2fd1d144464eaa9 Mon Sep 17 00:00:00 2001 From: neil Date: Thu, 25 Aug 2016 21:46:31 +0800 Subject: [PATCH] minor, fix _mktemp --- acme.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/acme.sh b/acme.sh index 2308e3fe..118e4879 100755 --- a/acme.sh +++ b/acme.sh @@ -722,11 +722,19 @@ _calcjwk() { _debug3 HEADER "$HEADER" } +_time() { + date -u "+%s" +} _mktemp() { if _exists mktemp ; then mktemp fi + if [ -d "/tmp" ] ; then + echo "/tmp/${PROJECT_NAME}wefADf24sf.$(_time).tmp" + return 0 + fi + _err "Can not create temp file." } _inithttp() { @@ -1504,7 +1512,7 @@ issue() { if [ -f "$DOMAIN_CONF" ] ; then Le_NextRenewTime=$(_readdomainconf Le_NextRenewTime) _debug Le_NextRenewTime "$Le_NextRenewTime" - if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ $(date -u "+%s" ) -lt $Le_NextRenewTime ] ; then + if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ $(_time) -lt $Le_NextRenewTime ] ; then _info "Skip, Next renewal time is: $(__green "$(_readdomainconf Le_NextRenewTimeStr)")" _info "Add '$(__red '--force')' to force to renew." return $RENEW_SKIP @@ -2053,7 +2061,7 @@ issue() { _info "And the full chain certs is there: $( __green " $CERT_FULLCHAIN_PATH ")" fi - Le_CertCreateTime=$(date -u "+%s") + Le_CertCreateTime=$(_time) _savedomainconf "Le_CertCreateTime" "$Le_CertCreateTime" Le_CertCreateTimeStr=$(date -u ) @@ -2113,7 +2121,7 @@ renew() { fi . "$DOMAIN_CONF" - if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(date -u "+%s" )" -lt "$Le_NextRenewTime" ] ; then + if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(_time)" -lt "$Le_NextRenewTime" ] ; then _info "Skip, Next renewal time is: $(__green "$Le_NextRenewTimeStr")" _info "Add '$(__red '--force')' to force to renew." return $RENEW_SKIP