From 90d22f78a128302eda0094efa699b5e90d4ec5e8 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sun, 2 Sep 2018 19:22:28 +0200 Subject: [PATCH 1/4] Fixes cron issues with dehydrated --- package/opt/hassbian/suites/duckdns.sh | 8 ++++---- package/opt/hassbian/suites/files/dehydrated_cron | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 package/opt/hassbian/suites/files/dehydrated_cron diff --git a/package/opt/hassbian/suites/duckdns.sh b/package/opt/hassbian/suites/duckdns.sh index f6648957..5a3b6406 100644 --- a/package/opt/hassbian/suites/duckdns.sh +++ b/package/opt/hassbian/suites/duckdns.sh @@ -70,13 +70,13 @@ chmod 700 duck.sh echo "Creating cron job..." (crontab -l ; echo "*/5 * * * * /home/homeassistant/duckdns/duck.sh >/dev/null 2>&1")| crontab - -if [ "$SSL_RESPONSE" == "y" ] || [ "$SSL_RESPONSE" == "Y" ]; then -(crontab -l ; echo "0 1 1 * * /home/homeassistant/dehydrated/dehydrated -c")| crontab - -fi -echo "Changing to root user..." EOF +if [ "$SSL_RESPONSE" == "y" ] || [ "$SSL_RESPONSE" == "Y" ]; then + cp /opt/hassbian/suites/files/dehydrated_cron /etc/cron.daily/dehydrated +fi + echo "Restarting cron service..." sudo systemctl restart cron.service diff --git a/package/opt/hassbian/suites/files/dehydrated_cron b/package/opt/hassbian/suites/files/dehydrated_cron new file mode 100644 index 00000000..e3cbd20a --- /dev/null +++ b/package/opt/hassbian/suites/files/dehydrated_cron @@ -0,0 +1,9 @@ +#!/bin/bash +# Updates run the dehydrated script to renew certificates + +echo "Changing to homeassistant user..." +sudo -u homeassistant -H /bin/bash << EOF + cd /home/homeassistant/dehydrated || exit + ./dehydrated -c + date >> /home/homeassistant/dehydrated/run_log +EOF \ No newline at end of file From 3e9dbd72f52e35d1dafe17686f204d4d1af0ec91 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sun, 2 Sep 2018 19:24:23 +0200 Subject: [PATCH 2/4] Premission fix --- package/opt/hassbian/suites/duckdns.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/opt/hassbian/suites/duckdns.sh b/package/opt/hassbian/suites/duckdns.sh index 5a3b6406..3e39ba7c 100644 --- a/package/opt/hassbian/suites/duckdns.sh +++ b/package/opt/hassbian/suites/duckdns.sh @@ -75,6 +75,7 @@ EOF if [ "$SSL_RESPONSE" == "y" ] || [ "$SSL_RESPONSE" == "Y" ]; then cp /opt/hassbian/suites/files/dehydrated_cron /etc/cron.daily/dehydrated + chmod +x /etc/cron.daily/dehydrated fi echo "Restarting cron service..." From dadb487c9d2503a71235651e16a50618590f0489 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sun, 2 Sep 2018 19:25:15 +0200 Subject: [PATCH 3/4] Updated description --- package/opt/hassbian/suites/files/dehydrated_cron | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/opt/hassbian/suites/files/dehydrated_cron b/package/opt/hassbian/suites/files/dehydrated_cron index e3cbd20a..2e6743c2 100644 --- a/package/opt/hassbian/suites/files/dehydrated_cron +++ b/package/opt/hassbian/suites/files/dehydrated_cron @@ -1,5 +1,5 @@ #!/bin/bash -# Updates run the dehydrated script to renew certificates +# Run the dehydrated script to renew certificates echo "Changing to homeassistant user..." sudo -u homeassistant -H /bin/bash << EOF From 688149dbdee31f832fd9d3038dac8c2fee087167 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sun, 2 Sep 2018 19:25:48 +0200 Subject: [PATCH 4/4] Added blank new line --- package/opt/hassbian/suites/files/dehydrated_cron | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/opt/hassbian/suites/files/dehydrated_cron b/package/opt/hassbian/suites/files/dehydrated_cron index 2e6743c2..46610974 100644 --- a/package/opt/hassbian/suites/files/dehydrated_cron +++ b/package/opt/hassbian/suites/files/dehydrated_cron @@ -6,4 +6,4 @@ sudo -u homeassistant -H /bin/bash << EOF cd /home/homeassistant/dehydrated || exit ./dehydrated -c date >> /home/homeassistant/dehydrated/run_log -EOF \ No newline at end of file +EOF