Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Add option to define update hour
Browse files Browse the repository at this point in the history
  • Loading branch information
theanonymousexyz committed May 18, 2022
1 parent 673a4af commit ac7b9c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1

[[ -f .env ]] && source .env
[[ -z $topic ]] && { echo -n "Enter your topic for https://ntfy.sh: "; read -r topic; }

CRONJOB="0 22 * * * /etc/upgrade.sh >/dev/null 2>&1"
[[ -z $topic ]] && read -rp "Enter your topic for https://ntfy.sh: " topic

cp -fv src/upgrade.sh /etc/upgrade.sh
sed -i "s/REPLACE_TOPIC/$topic/g" /etc/upgrade.sh
chmod +x /etc/upgrade.sh

read -rp "At what hour do you want the update to occur (enter value in 24 hour format, e.g. '21'): " hour
CRONJOB="0 $hour * * * /etc/upgrade.sh >/dev/null 2>&1"

if ! crontab -u root -l | grep -Fq "$CRONJOB"; then
echo "We're going to run unattended-upgrades via a cronjob instead of systemd."
echo -n "Please choose 'no' on the next prompt. Press enter when you're ready"
read -r
read -rp "Please choose 'no' on the next prompt. Press enter when you're ready."

dpkg-reconfigure unattended-upgrades

Expand Down

0 comments on commit ac7b9c3

Please sign in to comment.