Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #181 from ludeeus/DuckDNS-issues
Browse files Browse the repository at this point in the history
Fixes cron issues with dehydrated
  • Loading branch information
Landrash committed Sep 2, 2018
2 parents 4f0376b + 688149d commit abcfcc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions package/opt/hassbian/suites/duckdns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ 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
chmod +x /etc/cron.daily/dehydrated
fi

echo "Restarting cron service..."
sudo systemctl restart cron.service

Expand Down
9 changes: 9 additions & 0 deletions package/opt/hassbian/suites/files/dehydrated_cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# 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

0 comments on commit abcfcc7

Please sign in to comment.