Skip to content

Commit

Permalink
ncp-autoupdate: cronjob write to the log only (#1144)
Browse files Browse the repository at this point in the history
Cronjobs should not have any output, unless the cronjob fails, otherwise
an e-mail notification is sent with the output. This cronjob in
particular is also reporting results via Nextcloud notification, so
having an e-mail with logs saying the same as the notification is not
particularly useful. Instead we just redirect all output to the
/var/log/ncp.log so the user can debug in case of problems and doesn't
receive spurious e-mails when all works fine.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
llucax authored and nachoparker committed Jun 13, 2020
1 parent 4e79386 commit 337ffeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions bin/ncp/UPDATES/nc-autoupdate-ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ configure()
cat > /etc/cron.daily/ncp-autoupdate <<EOF
#!/bin/bash
source /usr/local/etc/library.sh
# Forward all output to the ncp log
exec > /var/log/ncp.log 2>&1
echo "\$(date) - Running \$0..."
if /usr/local/bin/ncp-test-updates; then
/usr/local/bin/ncp-update || exit 1
notify_admin "NextCloudPi" "NextCloudPi was updated to \$(cat /usr/local/etc/ncp-version)"
Expand Down
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v1.26.1](https://github.com/nextcloud/nextcloudpi/commit/8e36668) (2020-06-13) ncp-web: fix port checking
[v1.26.2](https://github.com/nextcloud/nextcloudpi/commit/d1a46c6) (2020-06-13) ncp-autoupdate: cronjob write to the log only (#1144)

[v1.26.0](https://github.com/nextcloud/nextcloudpi/commit/aedd8f0) (2020-06-11) upgrade to NC18.0.5
[v1.26.1](https://github.com/nextcloud/nextcloudpi/commit/4e79386) (2020-06-13) ncp-web: fix port checking

[v1.26.0 ](https://github.com/nextcloud/nextcloudpi/commit/aedd8f0) (2020-06-11) upgrade to NC18.0.5

[v1.25.0 ](https://github.com/nextcloud/nextcloudpi/commit/ed3619f) (2020-04-24) upgrade to NC18.0.4

Expand Down
2 changes: 1 addition & 1 deletion etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function run_app_unsafe()
chown root:www-data $log

echo "Running $ncp_app"
echo "[ $ncp_app ]" >> $log
echo "[ $ncp_app ] ($(date))" >> $log

# read script
unset configure
Expand Down

0 comments on commit 337ffeb

Please sign in to comment.