Skip to content

Instantly share code, notes, and snippets.

@mklooss
Created October 18, 2012 06:39
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 mklooss/3910193 to your computer and use it in GitHub Desktop.
Save mklooss/3910193 to your computer and use it in GitHub Desktop.
Tartarus Create Backups Configs (with Froxlor)
#!/bin/sh
for profile in /etc/tartarus/webs/*.conf; do
/usr/sbin/tartarus $* "$profile"
done
#!/bin/bash
echo "#################################################"
echo "#### Start Create Webs Tatarus Configurations ###"
echo "#################################################"
echo ""
SAVEPATH="/etc/tartarus/webs"
OLD_COPY="/etc/tartarus/webs_old"
TIMESTAMPS="/var/spool/tartarus/timestamps"
SEARCH_DIR="/var/customers/webs"
CURRENT_DATE=`date '+%u'`
FULLBACKDAY="7"
# check if folder exists
if [ -d $SAVEPATH ]; then
mv $SAVEPATH $OLD_COPY
mkdir $SAVEPATH
else
# create folder
mkdir -p $SAVEPATH
fi
# create timestamps for incrementelle Backups
if [ -d $TIMESTAMPS ]; then
#do nothing
echo "Timestamps Folder exists"
else
# create timestamp folder
echo "Create Timestamp Folder"
mkdir -p $TIMESTAMPS
fi
# foreach all webs
for web in $SEARCH_DIR/*; do
if [ -d $web ]; then
BASEFILE=`basename $web`
SAVEFILE=$SAVEPATH/$BASEFILE.conf
touch $SAVEFILE
echo "source /etc/tartarus/generic.inc" >> $SAVEFILE
echo "NAME=\"$BASEFILE\"" >> $SAVEFILE
echo "DIRECTORY=\"$web\"" >> $SAVEFILE
echo "CREATE_LVM_SNAPSHOT=\"no\"" >> $SAVEFILE
date '+%u'
if [ "$CURRENT_DATE" = "$FULLBACKDAY" ]; then
echo "-> $BASEFILE: Create Full Backup"
elif [ -r $OLD_COPY/$BASEFILE.conf ]; then
echo "INCREMENTAL_BACKUP=\"yes\"" >> $SAVEFILE
echo "-> $BASEFILE: Create Increment"
else
echo "-> $BASEFILE: Create Full Backup"
fi
echo "INCREMENTAL_TIMESTAMP_FILE=\"/var/spool/tartarus/timestamps/$BASEFILE\"" >> $SAVEFILE
echo "STORAGE_FTP_DIR=\"webs/$webs\"" >> $SAVEFILE
echo "source /etc/tartarus/charon.inc" >> $SAVEFILE
fi
done;
if [ -d $OLD_COPY ]; then
echo ""
echo "-> delete Old Config files"
rm -rf $OLD_COPY
fi
echo ""
echo "###################"
echo "#### Done Conf ####";
echo "###################"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment