When we run the Matomo archiving function to create reports through a cronjob nothing gets updated

We’re experience an issue with Matomo version 4.8.0 where reports aren’t generated when using a cronjob. When we change “Archive reports when viewed from the browser” to yes then all stats are updated nicely, when we change it to no and use the cronjob below, nothing happens.

Running a cronjob for archiving:

5 * * * * www-data /usr/bin/php -d memory_limit=-1 /external-ebs-storage/piwik/console core:archive --url=https://<our url> --force-periods day,week,month --php-cli-options 2>> /external-ebs-storage/piwik_logs/piwik-reports-errors.log | tee -a /external-ebs-storage/piwik_logs/piwik-archive.log > /dev/null

Which produces the following log:

INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  INIT
INFO [2022-03-17 23:20:02] 50612  Running Matomo 4.8.0 as Super User
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  NOTES
INFO [2022-03-17 23:20:02] 50612  - Async process archiving supported, using CliMulti.
INFO [2022-03-17 23:20:02] 50612  - Reports for today will be processed at most every 1800 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2022-03-17 23:20:02] 50612  - Archiving was last executed without error 1 hours 0 min ago.
INFO [2022-03-17 23:20:02] 50612  - Will only process the following periods: day, week, month (--force-periods)
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  START
INFO [2022-03-17 23:20:02] 50612  Starting Matomo reports archiving...
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 1.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 1, 0 API requests, Time elapsed: 0.029s [1 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 2.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 2, 0 API requests, Time elapsed: 0.011s [2 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 3.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 3, 0 API requests, Time elapsed: 0.011s [3 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 4.
INFO [2022-03-17 23:20:02] 50612    Will invalidate archived reports for today in site ID = 4's timezone (2022-03-18 00:00:00).
INFO [2022-03-17 23:20:02] 50612    Will invalidate archived reports for yesterday in site ID = 4's timezone (2022-03-17 00:00:00).
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 4, 0 API requests, Time elapsed: 0.112s [4 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 5.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 5, 0 API requests, Time elapsed: 0.011s [5 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 6.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 6, 0 API requests, Time elapsed: 0.011s [6 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Done archiving!
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  SUMMARY
INFO [2022-03-17 23:20:02] 50612  Processed 0 archives.
INFO [2022-03-17 23:20:02] 50612  Total API requests: 0
INFO [2022-03-17 23:20:02] 50612  done: 0 req, 343 ms, no error
INFO [2022-03-17 23:20:02] 50612  Time elapsed: 0.343s
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  SCHEDULED TASKS
INFO [2022-03-17 23:20:02] 50612  Starting Scheduled tasks...
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\CustomJsTracker\Tasks.updateTracker...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.022s
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteLogData...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.000s
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.001s
INFO [2022-03-17 23:20:02] 50612  done
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-18 00:20:02] 51012  ---------------------------
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 3, 0 API requests, Time elapsed: 0.011s [3 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 4.
INFO [2022-03-17 23:20:02] 50612    Will invalidate archived reports for today in site ID = 4's timezone (2022-03-18 00:00:00).
INFO [2022-03-17 23:20:02] 50612    Will invalidate archived reports for yesterday in site ID = 4's timezone (2022-03-17 00:00:00).
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 4, 0 API requests, Time elapsed: 0.112s [4 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 5.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 5, 0 API requests, Time elapsed: 0.011s [5 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Start processing archives for site 6.
INFO [2022-03-17 23:20:02] 50612  Finished archiving for site 6, 0 API requests, Time elapsed: 0.011s [6 / 6 done]
INFO [2022-03-17 23:20:02] 50612  Done archiving!
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  SUMMARY
INFO [2022-03-17 23:20:02] 50612  Processed 0 archives.
INFO [2022-03-17 23:20:02] 50612  Total API requests: 0
INFO [2022-03-17 23:20:02] 50612  done: 0 req, 343 ms, no error
INFO [2022-03-17 23:20:02] 50612  Time elapsed: 0.343s
INFO [2022-03-17 23:20:02] 50612  ---------------------------
INFO [2022-03-17 23:20:02] 50612  SCHEDULED TASKS
INFO [2022-03-17 23:20:02] 50612  Starting Scheduled tasks...
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\CustomJsTracker\Tasks.updateTracker...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.022s
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteLogData...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.000s
INFO [2022-03-17 23:20:02] 50612  Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO [2022-03-17 23:20:02] 50612  Scheduler: finished. Time elapsed: 0.001s
INFO [2022-03-17 23:20:02] 50612  done
INFO [2022-03-17 23:20:02] 50612  ---------------------------

Running a system check:

<details>
<summary>Click to view System Check</summary>

### Mandatory checks

#### PHP version >= 7.2.5:
 ✔ 7.4.3

#### PDO extension:
 ✔ 

#### PDO\MYSQL extension:
 ✔ 

#### MYSQLI extension:
 ✔ 

#### Other required extensions:
 ✔ zlib ✔ json ✔ filter ✔ hash ✔ session

#### Required functions:
 ✔ debug_backtrace ✔ eval ✔ hash ✔ gzcompress ✔ gzuncompress ✔ pack

#### Required PHP configuration (php.ini):
 ✔ session.auto_start = 0 ✔ max_execution_time = 0 OR = -1 OR >= 30

#### Directories with write access:
 ✔ $DOC_ROOT/tmp ✔ $DOC_ROOT/tmp/assets ✔ $DOC_ROOT/tmp/cache ✔ $DOC_ROOT/tmp/climulti ✔ $DOC_ROOT/tmp/latest ✔ $DOC_ROOT/tmp/logs ✔ $DOC_ROOT/tmp/sessions ✔ $DOC_ROOT/tmp/tcpdf ✔ $DOC_ROOT/tmp/templates_c


### Optional checks

#### Required Private Directories:
✔ 

#### File integrity:
 ✔ 

#### 64-bit PHP Binary:
 ✔ 

#### Tracker status:
 ✔ 

#### Memory limit:
 ✔ 512M

#### Time zone:
 ✔ 

#### Open URL:
 ✔ curl

#### PageSpeed is turned off:
 ✔ 

#### GD > 2.x + FreeType (graphics):
 ✔ 

#### Other extensions:
 ✔ json ✔ libxml ✔ dom ✔ SimpleXML ✔ openssl

#### Other functions:
 ✔ shell_exec ✔ set_time_limit ✔ mail ✔ parse_ini_file ✔ glob ✔ gzopen ✔ md5_file

#### Filesystem:
 ✔ 

#### Set up Cron - Managing processes via CLI:
 ✔ Ok

#### Last Successful Archiving Completion:
 ✔ The archiving process completed successfully 00:34:45 ago.

#### Database abilities:
 ✔ UTF8mb4 charset ✔ LOAD DATA INFILE ✔ CREATE TEMPORARY TABLES ✔ Changing transaction isolation level

#### Max Packet Size:
 ✔ 

#### Forced SSL Connection:
 ✔ 

#### Geolocation:
 ⚠ Warning: The default location provider guesses a visitor's country based on the language they use. This is not very accurate, so we recommend installing and using a geolocation database.

#### Update over HTTPS:
 ✔ 

#### Writable JavaScript Tracker ("/matomo.js" & "/piwik.js"):
 ✔ 


### Informational results

#### Matomo Version:
 4.8.0

#### Matomo Update History:
 4.4.0,4.2.1,4.1.1,3.11.0,

#### Matomo Install Version:
 Unknown - pre 3.8.

#### Latest Available Version:
 4.8.0

#### Is Git Deployment:
 0

#### PHP_OS:
 Linux

#### PHP SAPI:
 apache2handler

#### Timezone Version:
 0.system

#### PHP Timezone:
 UTC

#### PHP Time:
 1647603587

#### PHP Datetime:
 2022-03-18 11:39:47

#### PHP Disabled functions:
 pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, pcntl_unshare, 

#### PHP INI max_execution_time:
 3600

#### PHP INI post_max_size:
 20G

#### PHP INI max_input_vars:
 1000

#### PHP INI zlib.output_compression:
 

#### Curl Version:
 7.68.0, OpenSSL/1.1.1f

#### Suhosin Installed:
 0

#### DB Prefix:
 piwik_

#### DB Charset:
 utf8mb4

#### DB Adapter:
 PDO\MYSQL

#### MySQL Version:
 5.7.37-log

#### Num Tables:
 363

#### Browser Segment Archiving Enabled:
 1

#### Development Mode Enabled:
 0

#### Internet Enabled:
 1

#### Multi Server Environment:
 0

#### Auto Update Enabled:
 1

#### Custom User Path:
 0

#### Custom Include Path:
 0

#### Release Channel:
 latest_stable

#### Plugins Activated:
 API, Actions, Annotations, BulkTracking, Contents, CoreAdminHome, CoreConsole, CoreHome, CorePluginsAdmin, CoreUpdater, CoreVisualizations, CoreVue, CustomDimensions, CustomJsTracker, CustomVariables 4.0.1, DBStats, Dashboard, DevicePlugins, DevicesDetection, Diagnostics, Ecommerce, Events, Feedback, ForceSSL 4.0.1, GeoIp2, Goals, Heartbeat, ImageGraph, Insights, Installation, Intl, IntranetMeasurable, InvalidateReports 4.0.1, LanguagesManager, Live, Login, Marketplace, MobileMessaging, Monolog, Morpheus, MultiSites, Overlay, PagePerformance, PrivacyManager, ProfessionalServices, Proxy, Referrers, Resolution, RssWidget, SEO, ScheduledReports, SegmentEditor, SitesManager, Tour, Transitions, TwoFactorAuth, UserCountry, UserCountryMap, UserId, UserLanguage, UsersManager, VisitFrequency, VisitTime, VisitorInterest, VisitsSummary, WebsiteMeasurable, Widgetize

#### Plugins Deactivated:
 BotTracker 2.07, CustomAlerts 4.0.3, DevicePixelRatio 2.0.0, JsTrackerForceAsync 4.0.0, MarketingCampaignsReporting 4.1.1, MobileAppMeasurable, Provider 4.0.3, QueuedTracking 4.0.2, ReferrersManager 4.0.1, SearchEngineKeywordsPerformance 3.4.1, SecurityInfo 3.0.7, TagManager, TreemapVisualization 3.1.1

#### Plugins Invalid:
 

#### Server Info:
 Apache/2.4.41 (Ubuntu)

#### Had visits in last 1 day:
 1

#### Had visits in last 3 days:
 1

#### Had visits in last 5 days:
 1

#### Archive Time Last Started:
 1647601501

#### Archive Time Last Finished:
 1647601502

#### User Agent:
 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0

#### Browser Language:
 en-us,en

#### Total Invalidation Count:
 1125

#### In Progress Invalidation Count:
 0

#### Scheduled Invalidation Count:
 0

#### Earliest invalidation ts_started:
 

#### Latest invalidation ts_started:
 

#### Earliest invalidation ts_invalidated:
 2022-03-15 08:21:23

#### Latest invalidation ts_invalidated:
 2022-03-18 10:20:02

#### Number of segment invalidations:
 0

#### Number of plugin invalidations:
 0

#### List of plugins being invalidated:
 

#### Anonymize Referrer:
 

#### Do Not Track enabled:
 0

</details>

What could be the cause and how can this be solved?
Looking forward to your responses.