13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 4 ■ TAKING BACKUPS AND MANAGING DATA12 MESSAGE="/tmp/changemsg.txt"13 echo "Size of files changed in last 24 hrs: $TOTAL bytes" > $MESSAGE14 /usr/bin/mail -s "Filechange on $HOST" "$EMAIL" < $MESSAGE15 rm $MESSAGESave this script as /etc/cron.daily/filechange on each of your machines, and leave it there for aweek or so. You’ll get a daily e-mail from each machine telling you how much change there has been.Line 08 looks for files changed in the past 24 hours (-mtime -x checks for files that have been modified inthe last x × 24 hours); line 09 calls stat to get the size information in bytes. Lines 12–14 handle the mailsending.4-3. Backing Up Your WikiIf you’re using MediaWiki (see recipe 1-4), then your wiki information is kept in a database in MySQL.You should of course be backing up your databases as part of your regular backup strategy (see recipe4-4 for information on backing up MySQL), so from that point of view, your wiki and therefore yourinformation are safe.However, if something goes wrong with your MySQL server or with your Apache server, you maytemporarily not be able to get at the wiki, which is not much good if it contains your notes on how toresolve problems with MySQL and/or Apache! So, it’s a good idea to also have a static mirror.■ Note If you’re using a text-based wiki (for example, moinmoin) rather than a database-based one, this is less ofa problem, because you can access the files manually and read them with a text editor if need be. However, it’sprobably still a good idea to have a copy of the wiki files on a second machine (other than your web server),created either with httrack as described here or with a cronjob and cp.A good tool for this is httrack, which is a website-mirroring tool. (It’s available as the httrackpackage for Debian/Ubuntu or from http://www.httrack.com.)For a standard MediaWiki install living at http://wiki.example.com, this is the command to runfrom the command line:httrack "http://wiki.example.com/" -O "/home/jkemp/wikibackup" \"+*.example.com/*" "-*oldid*" -vTo run an update daily, edit your crontab with crontab -e, and add a line that looks like this:5 4 * * * httrack –update "http://wiki.example.com/" -O "/home/jkemp/wikibackup" "+*.example.com/*" "-*oldid*"100Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!