Skip to content

Instantly share code, notes, and snippets.

@renekreijveld

renekreijveld/sitesbackup

Last active Aug 29, 2015
Embed
What would you like to do?
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