Jan 03, 15:48 PM by Kai Jäger
So I realized today, reminded by
this sad story, that it was time to test my backups again (if you're doing regular backups, which you should, then it's a good idea to test them every now and then. No point in having backups if they don't work). So my backups worked, but I noticed that a few things on my web server were not yet being backed up at all. No big deal, since the files in question weren't all that important, but still... So I updated my backup script and realized that, considering how old it is and how little I know about shell scripting, it's pretty darn convenient. So here it is:
Click anywhere in the code to remove line numbers.
1 # Include config file
2 source backup.conf
3
4 # Handle errors
5 function error {
6 echo "Backup script was aborted prematurely due to a program error"|mail -s "Backup script error" $ERROR_EMAIL_ADDRESS
7 exit 1
8 }
9
10 trap error ERR
11
12 # Delete the old backup copy
13 rm -rf ./snapshot/*-*-*/
14
15 # Create a backup copy of the last snapshot
16 today=`date +%Y-%m-%d`
17 mv ./snapshot/current ./snapshot/$today
18
19 # Create a new folder for the current snapshot
20 mkdir ./snapshot/current
21
22 # Loop through all backup scripts
23 for file in ./tasks-enabled/*.sh; do
24 bash $file
25 done
26
27 # Tar up the files in the current snapshot
28 tarfile=backup_$today.tar.bz2
29 cd ./snapshot/current/
30 tar -cjf ../$tarfile ./
31 cd ../../
32
33 # Upload tar file to FTP
34 ncftpput -u $FTP_USER -p $FTP_PASSWORD $FTP_HOST / ./snapshot/$tarfile
35
36 # Delete tar file
37 rm ./snapshot/$tarfile Here's how it works: inside a folder named "tasks-enabled", there's a bunch of scripts that each back up one particular thing. Like for example there's a script that does a dump of all the MySQL databases. Similarly, there's a script that backs up the config files and so forth. Now the cool part is that if you need to back up something new, all you have to do is write a new script and put it in that folder. Actually, I have two folders ("tasks-available" and "tasks-enabled"), so that I can easily enable or disable tasks by creating or deleting links in the "tasks-enabled" folder (that's a common pattern, used for example by some versions of Apache). What's even better is that all the task scripts have to do is to copy their files to a folder called "snapshot/current". The main backup script then tars-up the folder and uploads it to my backup FTP server. It also keeps the last two backup "snapshots" around, so that you can easily restore something without having to go through the trouble of having to download it from the FTP site. For this script to work, you'll need the
NcFTP Client. There's also a config file in which you have to set the following variables: FTP_HOST, FTP_USER, FTP_PASSWORD and ERROR_EMAIL_ADDRESS (an email is sent to that address in case something goes wrong). Now all you have to do is create a crontab entry for it, and you're good.
Let me know if you see any flaws in this.
Dec 06 2008, 22:00 PM by Kai Jäger
I know, I know, it’s been more than two weeks since I released part two of this series, but I have a pretty good excuse for that: I had to give a presentation of my own. Of course I followed my own rules and what can I say: they seem to work. I had to talk for 90 minutes [...]
read the full article
Nov 15 2008, 20:37 PM by Kai Jäger
Finally, here is part two of my three-part series on how to give presentations that don’t suck. If you missed part one, you can always go back. If you’re still hungry for more information after you’ve read this article, be sure to check out Dazzle 'em with Style (thanks go to Marc for the heads up).Surprise your audienceMost presentations are [...]
read the full article
Nov 15 2008, 18:48 PM by Kai Jäger
The left-winged politician Lutz Heilmann has sued the German Wikipedia branch and has obtained an interim order that prohibits "Wikipedia Deutschland e. V." from forwarding the domain
wikipedia.de to
de.wikipedia.org which is under US jurisdiction. Apparently the Wikipedia
article on Lutz Heilmann contains some statements (
I assume regarding his involvement with the GDR secret police "Stasi" As it turns out, the lawsuit has nothing to do with his involvement with the "Stasi". It is about an incident where he allegly sent threats to an acquaintance via SMS.) that he deems slanderous.
If
Mr. Heilmann really wasn't involved with the "Stasi" and if his Wikipedia article in fact contains slanderous remarks, then he has every reason to be mad, but suing Wikipedia is probably the worst thing he could have done. For one, the article wasn't written by a single individual but by a whole bunch of people who seem to agree that the information given in the article is factual and well-founded. In a sense, Wikipedia represents the voice of the masses and Mr. Heilmann as member of a left-winged party should know better than to just censor it. He could have started an open discourse, clarified things, heck he could have sent a letter to the Wikipedia foundation asking them to freeze the page until the issue is resolved. Instead he chose to sue a non-profit organisation that gives millions of people access to vast amounts of information. Secondly, as Wikipedia is an organisation that is well-regarded by the public, the whole incident is bound to create a stir and a good amount of negative publicity. Also, I suspect that since the notice that appears on wikipedia.de mentions Heilmann's name, more people are now going to look him up... on Wikipedia... and be exposed to the "slanderous" remarks about him.
While the whole thing may not end up having the effect that Heilmann is hoping for, it shows how easily the Web can be censored. Sure, the
article on Heilmann is still available through the US domain, but the average "Hans Six-pack" may not know that. This is pretty scary, considering how imporant the Web has become as a source of unfiltered information.
Nov 06 2008, 22:36 PM by Kai Jäger
Presentations or talks are a lot like movies: most of the time they’re “okay”, sometimes they’re awful and every now and then a presentation comes along, that is so incredibly awesome, it will blow your mind. I have to sit through a lot of presentations these days and unfortunately so far, most of them have fallen into the awful-category. That’s [...]
read the full article