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

DuckDNS: Fixes cron issues with dehydrated #181

Merged
merged 4 commits into from
Sep 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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