Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update Check Shell Script for Shopware
#!/bin/bash
# Description
# This script will send an email when new updates for your Shopware installation are available.
# A Bash-script runed by an cronjob checks via console command for new updates and send you a mail.
# Usage
# Set SHOPWARE_PATH to your shopware docroot path. Change MAILTO to your email address.
# Try it and finally add a new cronjob to run once every night.
SHOPWARE_PATH="/var/www/vhosts/shopware/docroot"
MAILTO="root"
SUBJECT="Shopware Update!"
MAIL=$(which mail)
PHPCLI=$(which php)
TMPFLE=$(tempfile)
$PHPCLI $SHOPWARE_PATH/bin/console sw:store:list:updates --no-ansi > $TMPFLE
if [[ $(wc -l $TMPFLE | cut -d" " -f1) > 3 ]]; then
MAILRC=/dev/null $MAIL -n -s "$SUBJECT" $MAILTO < $TMPFLE
fi
rm $TMPFLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment