Yes, it is. you also need to download/copy the new files first. also, you might want to backup some stuff before updating. and it is most likely not a good idea to just update everything instantly without checking if there is a compatibility problem.
however, i asked ChatGPT for you: Careful, this is untested GPT content that might do you more harm than good!
To upgrade Matomo automatically using a cron job, you need to write a script that performs the upgrade steps and schedule it to run periodically. Below is a step-by-step guide to achieve this.
Prerequisites
Backup your data: Always ensure you have backups of your Matomo database and installation files before running any upgrade process.
Ensure permissions: The user running the cron job should have the appropriate permissions to perform file operations on the Matomo installation directory.
Steps to Upgrade Matomo Automatically
Create an Upgrade Script
Create a shell script that automates the upgrade process. For example, create a file named matomo_upgrade.sh with the following content:
#!/bin/bash
# Set variables
MATOMO_DIR="/path/to/matomo" # Change to your Matomo installation path
BACKUP_DIR="/path/to/backup" # Directory where you want to keep backups
MATOMO_URL="https://builds.matomo.org/matomo-latest.zip"
# Navigate to Matomo directory
cd $MATOMO_DIR || exit
# Backup current Matomo directory
tar -czf $BACKUP_DIR/matomo-backup-$(date +%F).tar.gz .
# Download latest Matomo version
wget $MATOMO_URL -O matomo-latest.zip
# Extract downloaded zip and overwrite the existing files
unzip -o matomo-latest.zip
# Cleanup
rm matomo-latest.zip
# Set proper permissions (Optional: Set these as per your server configuration)
chown -R www-data:www-data $MATOMO_DIR
chmod -R 755 $MATOMO_DIR
# Run Matomo database update (if necessary)
php $MATOMO_DIR/console core:update --yes
echo "Matomo upgrade completed successfully on $(date)"
MATOMO_DIR: The path to your Matomo installation.
BACKUP_DIR: The directory where backups will be stored.
MATOMO_URL: The URL to download the latest Matomo version.
Make the Script Executable
Give execute permissions to the script:
chmod +x /path/to/matomo_upgrade.sh
Set Up the Cron Job
Open your crontab file:
crontab -e
Add the following line to schedule the script to run periodically, e.g., every Sunday at 2 AM: