Skip to content

Instantly share code, notes, and snippets.

@pinguinpfleger
Created December 20, 2016 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinguinpfleger/415b54e0d56085bbc6543ee8974fcb3b to your computer and use it in GitHub Desktop.
Save pinguinpfleger/415b54e0d56085bbc6543ee8974fcb3b to your computer and use it in GitHub Desktop.
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