Skip to content

Instantly share code, notes, and snippets.

@yoneken
Created July 26, 2012 04:15
Show Gist options
  • Save yoneken/3180221 to your computer and use it in GitHub Desktop.
Save yoneken/3180221 to your computer and use it in GitHub Desktop.
A shell script for backup a mediawiki data.
#!/bin/sh
filename=~/bkup/wiki$(date +%Y%m%d).xml
ssh mediawiki_serv php ./www/wiki/maintenance/dumpBackup.php --full > $filename
md5=`md5sum $filename | cut -c 1-32`
lmd5=`cat ~/bkup/last_md5`
if [ "$lmd5" != "$md5" ]
then
echo "$md5" > ~/bkup/last_md5
#echo "The latest backup file is not same with last one."
else
rm $filename
#echo "The latest backup file is same with last one. Delete it."
fi
#echo "$filename md5:$md5 lmd5:$lmd5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment