<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.robnugen.com/w/index.php?action=history&amp;feed=atom&amp;title=Programming%3ARob_backup.sh</id>
	<title>Programming:Rob backup.sh - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.robnugen.com/w/index.php?action=history&amp;feed=atom&amp;title=Programming%3ARob_backup.sh"/>
	<link rel="alternate" type="text/html" href="https://wiki.robnugen.com/w/index.php?title=Programming:Rob_backup.sh&amp;action=history"/>
	<updated>2026-04-07T01:29:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.robnugen.com/w/index.php?title=Programming:Rob_backup.sh&amp;diff=1451&amp;oldid=prev</id>
		<title>Thunderrabbit: post backup script</title>
		<link rel="alternate" type="text/html" href="https://wiki.robnugen.com/w/index.php?title=Programming:Rob_backup.sh&amp;diff=1451&amp;oldid=prev"/>
		<updated>2014-05-20T13:54:21Z</updated>

		<summary type="html">&lt;p&gt;post backup script&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Thanks [http://www.mediawiki.org/wiki/User:Flominator/Backup_MW Flominator]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash                                                                                                     &lt;br /&gt;
&lt;br /&gt;
# before running, copy this file to the wiki root directory, in this case ~/wiki.robnugen.com/w/                &lt;br /&gt;
&lt;br /&gt;
FNAME=wiki.rn.com.bak.`date +%Y-%m-%d_%H%M%S`&lt;br /&gt;
BACKUP_DIR=~/rn.com.back&lt;br /&gt;
BACKUP_DIR_ID_DOUBLECHECK=00_THIS_IS_THE_BACKUP_DIRECTORY.txt&lt;br /&gt;
&lt;br /&gt;
mysqldump -h DBHOST -u DBUSER -pDBPASSWORD DBNAME &amp;gt; ${FNAME}.sql&lt;br /&gt;
zip -r ${BACKUP_DIR}/${FNAME}.zip images/ ${FNAME}.sql LocalSettings.php extensions/&lt;br /&gt;
&lt;br /&gt;
# for quickly testing zip portion:                                                                              &lt;br /&gt;
# zip -r ${BACKUP_DIR}/${FNAME}.zip  LocalSettings.php                                                          &lt;br /&gt;
rm ${FNAME}.sql&lt;br /&gt;
&lt;br /&gt;
cd ${BACKUP_DIR}&lt;br /&gt;
&lt;br /&gt;
if [[ ! -f ${BACKUP_DIR_ID_DOUBLECHECK} ]]; then&lt;br /&gt;
   echo &amp;quot;NOT DELETING FILES because I&amp;#039;m not sure I&amp;#039;m in the backup directory.&amp;quot;&lt;br /&gt;
   echo &amp;quot;I failed to find the file &amp;quot; ${BACKUP_DIR}/${BACKUP_DIR_ID_DOUBLECHECK}&lt;br /&gt;
   exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
pwd&lt;br /&gt;
ls -al&lt;br /&gt;
&lt;br /&gt;
#Count files in directory (hidden files (filename starts with a dot) are ignored)                               &lt;br /&gt;
file_count=`ls | wc -l`&lt;br /&gt;
&lt;br /&gt;
#Do while there are more than or equal 6 files present                                                          &lt;br /&gt;
while [ $file_count -ge 6 ]&lt;br /&gt;
do&lt;br /&gt;
    rm `ls -tr | head -n 1`&lt;br /&gt;
    file_count=`ls | wc -l`&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# make sure the file date is the very latest and therefore will not be wiped                                    &lt;br /&gt;
touch ${BACKUP_DIR}/${BACKUP_DIR_ID_DOUBLECHECK}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Thunderrabbit</name></author>
	</entry>
</feed>