Archive for May, 2007

Fixing X11 no more

Wednesday, May 30th, 2007

Last week, after building my own computers to run Linux for about 10 years, I ordered a computer from Dell with Ubuntu Linux pre-installed. Don’t get me wrong– I have enjoyed at least 80% of the hacking, crashing X11 repeatedly, trying to disable X11, giving up and using the terminal window at 640 x 480, crashing X11 repeatedly, and so on. In the last 2 or 3 years, Linux has become solid enough that I rarely need to perform tasks akin to surgery. With tested hardware from Dell, instead of hardware randomly selected from different (non-Belkin) vendors, I’m betting that I may not need to edit xorg.conf at all!

As I prepare to enter the realm of normal people, the realm of adults who buy computers to get work done, who don’t know about lolcats or frist psot, HTTP redirection or ARP cache poisoning, SSH or even RSS, it’s time for me to pass on what I sincerely hope will become useless tips.

When your GUI goes crazy, the screen starts cycling on and off, or just searching for inputs eternally:

1. Use Ctrl-Alt-Backspace to stop the X server and drop to a command prompt. Then you can try looking at /etc/X11/xorg.conf to see what’s wrong and restart X using the command startx.

2. Enable sshd as soon as you can, so that something goes horribly wrong, you can still ssh into the machine and execute commands.

3. Use Ctrl-Alt-F2 (or higher F-keys) to cycle to additional terminal windows if, as was generally the case, X is screwed up.

Those three tricks have kept me going for tens, or maybe even hundreds, of hours of debugging.

So, maybe I’ll need these skills again when the hard times come and production of new computers grinds to a halt, but until then, I’m turning my attention to higher level tasks, like implementing a sun-tracking algorithm in Python.

Exavault rsync script

Monday, May 28th, 2007

The company I work for recently started using a service called Exavault to back up our data. We have a server running Linux that logs into our NAS using ssh every night and rsyncs the data with a local directory. It also dumps our mediawiki database (well, used to– we’re using Socialtext now) and subversion repository.

All of this data gets synchronized with Exavault’s machines in Dublin, California.

This has been running with no known problems for about six months. Below are the bash scripts I wrote to do the synchronization.

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing chemp to Exavault, starting $(date +%FT%T)" >> $LOGFILE
echo "Dumping wiki database" >> $LOGFILE
mv /home/brandon/wiki_backup/wiki_dump /home/brandon/wiki_backup/wiki_dump.old
mysqldump --user=root --password=****** greenmountain > /home/brandon/wiki_backup/wiki_dump
rm /home/brandon/wiki_backup/wiki_dump.old
echo "Dumped wiki database" >> $LOGFILE
echo "Dumping Subversion repository" >> $LOGFILE
mv /home/brandon/svn_backup/svn_dump /home/brandon/svn_backup/svn_dump.old
svnadmin dump /home/brandon/svn/NCL2 > /home/brandon/svn_backup/svn_dump
rm -r /home/brandon/svn_backup/svn_dump.old
echo "Dumped Subversion repository" >> $LOGFILE
echo "Backing up files from Q, SVN, and wiki" >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/Q_backup/ greenmountain@greenmountain.exavault.com:backup-test/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/svn_backup/ greenmountain@greenmountain.exavault.com:backup-svn/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/wiki_backup/ greenmountain@greenmountain.exavault.com:backup-wikidb/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /var/www/wiki/ greenmountain@greenmountain.exavault.com:backup-wiki/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "----------------***-------------------" >> $LOGFILE

The other script:

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing Q to Chemp, starting $(date +%FT%T)" >> $LOGFILE
rsync -a --exclude-from=no_backup.txt --progress root@192.168.2.4:/raid/WeatherPhenom/  /home/brandon/Q_backup/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "---------------------------------" >> $LOGFILE