From 591b76e36252dfd7a84695a9def3d39cd395ff97 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Tue, 28 Feb 2017 13:10:54 +0100 Subject: [PATCH] Fix for date and if argument --- lets-encrypt/test-new-config.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lets-encrypt/test-new-config.sh b/lets-encrypt/test-new-config.sh index 761b785d..d777f0da 100644 --- a/lets-encrypt/test-new-config.sh +++ b/lets-encrypt/test-new-config.sh @@ -29,6 +29,8 @@ then read -p "Press any key to continue... " -n1 -s echo -e "\e[0m" crontab -u root -l | { cat; echo "@monthly $SCRIPTS/letsencryptrenew.sh"; } | crontab -u root - +DATE='$(date +%Y-%m-%d_%H:%M)' +IF='if [[ $? -eq 0 ]]' cat << CRONTAB > "$SCRIPTS/letsencryptrenew.sh" #!/bin/sh service apache2 stop @@ -38,11 +40,11 @@ if ! /etc/letsencrypt/letsencrypt-auto renew > /var/log/letsencrypt/renew.log 2> exit 1 fi service apache2 start -if [[ $? -eq 0 ]] +$IF then - echo "Let's Encrypt SUCCESS!"--$(date +%Y-%m-%d_%H:%M) >> /var/log/letsencrypt/cronjob.log + echo "Let's Encrypt SUCCESS!"--$DATE >> /var/log/letsencrypt/cronjob.log else - echo "Let's Encrypt FAILED!"--$(date +%Y-%m-%d_%H:%M) >> /var/log/letsencrypt/cronjob.log + echo "Let's Encrypt FAILED!"--$DATE >> /var/log/letsencrypt/cronjob.log reboot fi CRONTAB