Skip to content

Commit f256702

Browse files
szaimenenoch85
andauthored
update updatenotification to be able to run the cronjob every day (#1141)
Co-authored-by: Daniel Hansson <[email protected]>
1 parent 88e7c2f commit f256702

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

nextcloud_install_production.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ occ_command config:system:set upgrade.disable-web --value="true"
396396
print_text_in_color "$ICyan" "Configuring update notifications specific for this server..."
397397
download_static_script updatenotification
398398
check_command chmod +x "$SCRIPTS"/updatenotification.sh
399-
crontab -u root -l | { cat; echo "59 $AUT_UPDATES_TIME * * 6 $SCRIPTS/updatenotification.sh > /dev/null 2>&1"; } | crontab -u root -
399+
crontab -u root -l | { cat; echo "59 $AUT_UPDATES_TIME * * * $SCRIPTS/updatenotification.sh > /dev/null 2>&1"; } | crontab -u root -
400400

401401
# Change values in php.ini (increase max file size)
402402
# max_execution_time

static/updatenotification.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,32 @@ debug_mode
1919
# Check if root
2020
root_check
2121

22+
REPORTEDNCVERSION=""
23+
24+
if [ "$CURRENTVERSION" == "$NCVERSION" ]
25+
then
26+
print_text_in_color "$IGreen" "You already run the latest version! ($NCVERSION)"
27+
exit
28+
fi
29+
30+
if [ "$REPORTEDNCVERSION" == "$NCVERSION" ]
31+
then
32+
print_text_in_color "$ICyan" "The notification regarding the new Nextcloud update has been already reported! ($NCVERSION)"
33+
exit
34+
fi
35+
2236
if version_gt "$NCVERSION" "$CURRENTVERSION"
2337
then
2438
if crontab -l -u root | grep $SCRIPTS/update.sh
2539
then
2640
notify_admin_gui \
2741
"New Nextcloud version!" \
2842
"Nextcloud $NCVERSION just became available. Since you are running Automatic Updates at $AUT_UPDATES_TIME:00, you don't need to bother about updating the server manually, as that's already taken care of."
43+
sed -i "s|^REPORTEDNCVERSION.*|REPORTEDNCVERSION=$NCVERSION|" $SCRIPTS/updatenotification.sh
2944
else
3045
notify_admin_gui \
31-
"Update availabile!" \
46+
"Update available!" \
3247
"Nextcloud $NCVERSION is available. Please run 'sudo bash /var/scripts/update.sh' from your CLI to update your server."
48+
sed -i "s|^REPORTEDNCVERSION.*|REPORTEDNCVERSION=$NCVERSION|" $SCRIPTS/updatenotification.sh
3349
fi
34-
else
35-
print_text_in_color "$IGreen" "You already run the latest version! ($NCVERSION)"
3650
fi

0 commit comments

Comments
 (0)