Cron job system:cron interfiers with activity notification

Steps to reproduce

  1. I have changed the cron configuration in the owncloud Admin Area from Ajax to cron.
  2. Added a new cron job following the instructions from https://doc.owncloud.org/server/10.6/admin_manual/configuration/server/background_jobs_configuration.html:
# sudo crontab -u www-data -e
*  *  *  *  * /usr/bin/php -f /path/to/your/owncloud/occ system:cron

Expected behaviour

It should run cron every minute.

Actual behaviour

The email received from the Activity app, doesn’t show the custom logo anymore, and the URL to the owncloud is not right, instead every file links to an URL like this one: http://localhost/index.php/f/14879

Server configuration

Operating system:
Ubuntu 18.04.5 LTS
Web server:
Apache/2.4.29 (Ubuntu)
Database:
Server version: 10.5.9-MariaDB-1:10.5.9+maria~bionic mariadb.org binary distribution
PHP version:
PHP 7.4.16 (cli) (built: Mar 5 2021 07:54:20) ( NTS )
Copyright © The PHP Group
Zend Engine v3.4.0, Copyright © Zend Technologies
with Zend OPcache v7.4.16, Copyright ©, by Zend Technologies
ownCloud version: (see ownCloud admin page)
10.7.0.4
Updated from an older ownCloud or fresh install:
fresh install
Where did you install ownCloud from:
source

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Enabled:

  • activity:
    • Version: 2.6.0
    • Path: /var/www/owncloud/apps/activity
  • calendar:
    • Version: 1.6.4
    • Path: /var/www/owncloud/apps-external/calendar
  • comments:
    • Version: 0.3.0
    • Path: /var/www/owncloud/apps/comments
  • configreport:
    • Version: 0.2.0
    • Path: /var/www/owncloud/apps/configreport
  • contacts:
    • Version: 1.5.5
    • Path: /var/www/owncloud/apps-external/contacts
  • dav:
    • Version: 0.6.0
    • Path: /var/www/owncloud/apps/dav
  • federatedfilesharing:
    • Version: 0.5.0
    • Path: /var/www/owncloud/apps/federatedfilesharing
  • files:
    • Version: 1.5.2
    • Path: /var/www/owncloud/apps/files
  • files_antivirus:
    • Version: 0.15.2
    • Path: /var/www/owncloud/apps/files_antivirus
  • files_external:
    • Version: 0.7.1
    • Path: /var/www/owncloud/apps/files_external
  • files_mediaviewer:
    • Version: 1.0.4
    • Path: /var/www/owncloud/apps/files_mediaviewer
  • files_pdfviewer:
    • Version: 0.12.1
    • Path: /var/www/owncloud/apps-external/files_pdfviewer
  • files_sharing:
    • Version: 0.14.0
    • Path: /var/www/owncloud/apps/files_sharing
  • files_texteditor:
    • Version: 2.3.0
    • Path: /var/www/owncloud/apps/files_texteditor
  • files_trashbin:
    • Version: 0.9.1
    • Path: /var/www/owncloud/apps/files_trashbin
  • files_versions:
    • Version: 1.3.0
    • Path: /var/www/owncloud/apps/files_versions
  • firstrunwizard:
    • Version: 1.2.0
    • Path: /var/www/owncloud/apps/firstrunwizard
  • market:
    • Version: 0.6.0
    • Path: /var/www/owncloud/apps/market
  • notifications:
    • Version: 0.5.2
    • Path: /var/www/owncloud/apps/notifications
  • provisioning_api:
    • Version: 0.5.0
    • Path: /var/www/owncloud/apps/provisioning_api
  • systemtags:
    • Version: 0.3.0
    • Path: /var/www/owncloud/apps/systemtags
  • templateeditor:
    • Version: 0.4.0
    • Path: /var/www/owncloud/apps/templateeditor
  • theme-sintas:
    • Version: 1.0.0
    • Path: /var/www/owncloud/apps-external/theme-sintas
  • updatenotification:
    • Version: 0.2.1
    • Path: /var/www/owncloud/apps/updatenotification
      Disabled:
  • admin_audit:
    • Path: /var/www/owncloud/apps/admin_audit
  • announcementcenter:
    • Path: /var/www/owncloud/apps/announcementcenter
  • customgroups:
    • Path: /var/www/owncloud/apps/customgroups
  • encryption:
    • Path: /var/www/owncloud/apps/encryption
  • enterprise_key:
    • Path: /var/www/owncloud/apps/enterprise_key
  • external:
    • Path: /var/www/owncloud/apps/external
  • federation:
    • Path: /var/www/owncloud/apps/federation
  • files_classifier:
    • Path: /var/www/owncloud/apps/files_classifier
  • files_external_dropbox:
    • Path: /var/www/owncloud/apps/files_external_dropbox
  • files_external_ftp:
    • Path: /var/www/owncloud/apps/files_external_ftp
  • files_ldap_home:
    • Path: /var/www/owncloud/apps/files_ldap_home
  • files_lifecycle:
    • Path: /var/www/owncloud/apps/files_lifecycle
  • firewall:
    • Path: /var/www/owncloud/apps/firewall
  • graphapi:
    • Path: /var/www/owncloud/apps/graphapi
  • guests:
    • Path: /var/www/owncloud/apps/guests
  • metrics:
    • Path: /var/www/owncloud/apps/metrics
  • oauth2:
    • Path: /var/www/owncloud/apps/oauth2
  • openidconnect:
    • Path: /var/www/owncloud/apps/openidconnect
  • password_policy:
    • Path: /var/www/owncloud/apps/password_policy
  • ransomware_protection:
    • Path: /var/www/owncloud/apps/ransomware_protection
  • sharepoint:
    • Path: /var/www/owncloud/apps/sharepoint
  • systemtags_management:
    • Path: /var/www/owncloud/apps/systemtags_management
  • theme-enterprise:
    • Path: /var/www/owncloud/apps/theme-enterprise
  • user_external:
    • Path: /var/www/owncloud/apps/user_external
  • user_ldap:
    • Path: /var/www/owncloud/apps/user_ldap
  • user_shibboleth:
    • Path: /var/www/owncloud/apps/user_shibboleth
  • windows_network_drive:
    • Path: /var/www/owncloud/apps/windows_network_drive
  • wopi:
    • Path: /var/www/owncloud/apps/wopi
  • workflow:
    • Path: /var/www/owncloud/apps/workflow

Are you using external storage, if yes which one: local/smb/sftp/…

Are you using encryption: yes/no
no

This is IMHO far too often, mine is set to each 10 minutes.

Well, localhost… :roll_eyes:

1 Like
*/15  *  *  *  * /usr/bin/php -f /path/to/your/owncloud/occ system:cron

Oh well, that was an example. The problem I found is, when I set up this cron task, then the URL in the activity email changes from my domain to localhost.

Why did you decide not to provide your config.php as it was requested in the issue template?

I’m pretty sure the reason can be found there.

2 Likes

Ok, I run:

sudo -u www-data php occ config:list system

{
“system”: {
“instanceid”: “xxxxxxxxxxxxxx”,
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: [
“xxxxxxxxxxxxxxx”
],
“datadirectory”: “/var/www/owncloud/data”,
“overwrite.cli.url”: “http://localhost”,
“dbtype”: “mysql”,
“version”: “10.7.0.4”,
“dbname”: “owncloud”,
“dbhost”: “localhost”,
“dbtableprefix”: “oc_”,
“mysql.utf8mb4”: true,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“logtimezone”: “Europe/Berlin”,
“apps_paths”: [
{
“path”: “/var/www/owncloud/apps”,
“url”: “/apps”,
“writable”: false
},
{
“path”: “/var/www/owncloud/apps-external”,
“url”: “/apps-external”,
“writable”: true
}
],
“installed”: true,
“memcache.local”: “\OC\Memcache\APCu”,
“mail_domain”: “REMOVED SENSITIVE VALUE”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_smtpmode”: “smtp”,
“mail_smtpsecure”: “ssl”,
“mail_smtpauthtype”: “LOGIN”,
“mail_smtpauth”: 1,
“mail_smtphost”: “REMOVED SENSITIVE VALUE”,
“mail_smtpport”: “465”,
“mail_smtpname”: “REMOVED SENSITIVE VALUE”,
“mail_smtppassword”: “REMOVED SENSITIVE VALUE”,
“loglevel”: 2,
“skeletondirectory”: “/var/www/owncloud/apps-external/alternative-skeleton”,
“integrity.ignore.missing.app.signature”: [
“theme-custom”
],
“maintenance”: false
}
}

Your overwrite.cli.uri value is causing the issue.
I’d strongly recommend to review the comments in config.sample.php in your config directory, especially overwrite.cli.uri

1 Like

Great @cortho, I have done the changes in the ‘overwrite.cli.url’ and it works.
Thank you very much.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.