Monthly Archives: June 2006

useful tool: monit

Useful tool: Monit

Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses to much resources. You can use monit to monitor files, directories and devices for changes, such as timestamp changes, checksum changes or size changes. You can also monitor remote hosts; monit can ping a remote host and can check TCP/IP port connections and server protocols…

(Thanks to AndrewMc for this tip).

visual diff tools

I usually use vimdiff to find the differences between two files; here are some gui tools that do the same thing:

  • meld – though version 1.0.0 doesn’t allow line-by-line replacements (I’m told later versions do)
  • mgdiff – doesn’t allow line-by-line replacements
  • tkdiff – doesn’t allow line-by-line replacements
  • kompare – allows line-by-line replacements, but the interface is a bit clunky (in that you can’t easily choose to take diffs from both files without reversing direction)

So kompare seems the best, though none seem as good as Windows tools I’ve used – perhaps time to submit some changes to one of these projects…

sharing application data on a dual boot laptop

I dual boot my laptop between Linux and Windows – mostly Linux, but occasionally Windows. Here’s how to make applications like Firefox, Thunderbird, etc share their configuration – especially useful for bookmarks and saved passwords for Firefox. This how-to presumes that your Linux username is sonia and your user id is 1000 (check by running the id function). It also presumes that you can see system folders in Windows – setup in Windows Explorer under Tools, Options, View, Show hidden files and Folders, Click Apply to All Folders.

Create a Shared Partition

First you need a filesystem that will be shared between both Linux and Windows – it has to be FAT, as this is the only filesystem that both operating systems (easily) read. This may involve shrinking an existing filesystem and partition. (You could of course lose data doing this, so check your backups first).

The key idea here is that each partition (eg /dev/hda6) has a filesystem (eg Reiserfs or Ext3) located inside. To shrink a partition, the filesystem needs to be shrunk first; the easiest way to do this is to shrink the filesystem too small, delete the partition and recreate it smaller, then expand the filesystem to fit the newly shrunk partition:

  • boot off Knoppix
  • shrink the filesystem before the partition. For example if using ReiserFS and hda6:
 resize_reiserfs -s 10G /dev/hda6
  • using fdisk/cfdisk, resize the partition by deleting the existing partition and recreating it with a smaller size. Ensure the new partition is larger than the resized filesystem.
  • expand the previous filesystem so it fills the shrunk partition:
 resize_reiserfs /dev/hda6
  • check and mount the shrunk partition before creating the new partition and filesystem, in case you’ve made a mistake

 reiserfsck /dev/hda6
 mount /dev/hda6
  • in fdisk/cfdisk, also create the new partition (/dev/hda7 in this case), set the type to 0C (Windows FAT LBA)
  • create the new shared filesystem:
 mkfs.vfat /dev/hda7

Mount the Shared Partition in Linux

  • create a mount directory
 cd /
 sudo mkdir /configs
 sudo chown 1000. /configs
  • add an entry to /etc/fstab to mount at boot:
 /dev/hda7       /configs        vfat    defaults,uid=1000,gid=1000        0       0
  • reboot to linux and check the partition mounts OK by trying to create a test file in /configs using your normal user account, not root

Get Firefox to Locate Configuration in Linux

  • close Firefox and move your profile – it’ll be a directory named something like 123456.default:

 mkdir -p /configs/.mozilla/firefox
 mv ~/.mozilla/123456.default /configs/.mozilla/firefox
  • config Firefox to use the new location; change these settings in ~/.mozilla/firefox/profiles.ini:
 IsRelative=0
 Path=/configs/.mozilla/firefox/123456.default
  • check Firefox runs OK – if the Profiles screen pops up, you’ve got some sort of error

Mount the Shared Partition in Windows

  • boot into Windows. The partition should be located automatically, you may want to change the drive letter (to say Z:) using Computer Management

Get Firefox to Locate Configuration in Windows

  • edit the file profiles.ini, located in the directory C:Documents and SettingssoniaApplication DataMozillaFirefox
  • change the following settings
 IsRelative=0
 Path=Z:.mozillafirefox123456.default

Thunderbird

The process is similar for Thunderbird. Under Linux the file is ~/mozilla-thunderbird/profiles.ini, under Windows C:Documents and SettingssoniaApplication DataThunderbirdprofiles.ini.

Notes

Notes taken from Linux Journal article, June 2006

ubuntu/debian runlevels

Two useful tools for modifying Debian/Ubuntu runlevels (apart from just editing the links directly in /etc/rc?.d):

  • update-rc.d
  • rcconf – a frontend to update-rc.d