Skip to content

Instantly share code, notes, and snippets.

@renekreijveld
Last active August 29, 2015 14:03
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 renekreijveld/e7b13bd31126f6514a93 to your computer and use it in GitHub Desktop.
Save renekreijveld/e7b13bd31126f6514a93 to your computer and use it in GitHub Desktop.
Find Joomla instances and backup them
#!/bin/sh
# sitesbackup -- Find Joomla instances and backup them
# Supports all Joomla versions
# Requires jbackupstore script
#
# Backups older than 5 days are automatically cleaned
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
# define variables
STARTDIR="/home"
STOREPATH=/backups/sites
JBACKUPSTORE=/usr/local/sbin/jbackupstore
LOGFILE=/usr/local/sbin/sitesbackup.log
for dir in `find $STARTDIR -maxdepth 4 -type d -name "public_html"`; do
if [ -f $dir/configuration.php ]; then
# possible joomla found
cd $dir
echo "`date` Joomla found in $dir" >> ${LOGFILE}
# Run backup script
${JBACKUPSTORE}
fi
done
# cleanup backups older than 5 days
cd ${STOREPATH}
find . -mtime +5 -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment