Skip to content

Commit

Permalink
notify_push: fix service not restarting on binary update (#1398)
Browse files Browse the repository at this point in the history
* notify_push: fix service not restarting on binary update

Signed-off-by: Tobias K <[email protected]>

* notify_push: fix cronjob path and add executable flag

Signed-off-by: Tobias K <[email protected]>

* notify_push: Don't restart notify_push.service when setting up the update watcher

Signed-off-by: Tobias K <[email protected]>
  • Loading branch information
theCalcaholic authored and nachoparker committed Dec 9, 2021
1 parent 5a404c0 commit 26a7778
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions updates/1.46.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

This comment has been minimized.

Copy link
@SoongJr

SoongJr Dec 25, 2021

Contributor

previous updates-scripts started with set -e, would have been cleaner to do this here, too?

# docker images only
[[ -f /.docker-image ]] && {
cat <<EOF > /etc/cron.daily/refresh_notify_push
#!/usr/bin/env bash
. /usr/local/etc/library.sh
ncc notify_push:self-test || {
killall notify_push
sleep 1
start_notify_push
}"

This comment has been minimized.

Copy link
@SoongJr

SoongJr Dec 25, 2021

Contributor

This looks to me like a stray quotation mark, is the resulting script tested? I'm not a perfect expert on bash, so there might be a reason for a singular double-quote that I just don't realize ;)

EOF
chmod +x /etc/cron.daily/refresh_notify_push
}

# for non docker images
[[ ! -f /.docker-image ]] && {

This comment has been minimized.

Copy link
@SoongJr

SoongJr Dec 25, 2021

Contributor

Previous updates-scripts all ended with a final exit 0 statement, this is missing here. As the check in this line returns non-zero in docker images, and it is the last statement in the script, its exit code is used as the overall exit code of the script, aborting the update in docker images and causing #1405

cat > /etc/systemd/system/refresh_notify_push.service <<EOF
[Unit]
Description = Restart notify_push service when the NC app is updated
[Service]
Type = oneshot
ExecStart = systemctl restart notify_push.service
[Install]
WantedBy = multi-user.target
EOF
cat > /etc/systemd/system/refresh_notify_push.path <<EOF
[Unit]
Description = Path watcher component for refresh_notify_push.service
[Path]
PathModified = /var/www/nextcloud/apps/notify_push/
[Install]
WantedBy = multi-user.target
EOF

systemctl daemon-reload
systemctl enable refresh_notify_push.{path,service}
systemctl restart refresh_notify_push.path
}

0 comments on commit 26a7778

Please sign in to comment.