Ftp Synchronisation

A customer of mine is making some files available to me on an FTP server. As I need those locally, I searched around for a solution to synchronize those files to a local folder.

I have found the great tool called lftp which is available from the Ubuntu’s repositories. I use that command in a crontab:

lftp ftp://user:password@ftp.host.com -e "mirror -e / /path/to/my/local/folder ; quit"

Monitoring IBM hardware RAID (SAS1064ET PCI-Express Fusion-MPT SAS)

I have an IBM X2 server with a hardware RAID handled by an LSI card (SAS1064ET PCI-Express Fusion-MPT SAS) and running Ubuntu 10.04 Lucid. I needed to monitor my RAID status and searched a lot on the web but I finally got it.

Getting raid status from command line

First install mpt-status

sudo apt-get install mpt-status

Then checkout if mptctl kernel module is loaded

sudo lsmod | grep mptctl

I personally get:

mptctl                 31642  0 
mptbase                91642  3 mptctl,mptsas,mptscsih

If you don’t, load it

sudo modprobe mptctl

Then launch mpt-status

sudo mpt-status -p

I get

Checking for SCSI ID:0
Checking for SCSI ID:1
Checking for SCSI ID:2
Checking for SCSI ID:3
Checking for SCSI ID:4
Checking for SCSI ID:5
Checking for SCSI ID:6
Checking for SCSI ID:7
Checking for SCSI ID:8
Checking for SCSI ID:9
Found SCSI id=9, use ''mpt-status -i 9`` to get more information.

So, as said, I run

sudo mpt-status -i 9

And I now have my raid status

ioc0 vol_id 9 type IM, 2 phy, 698 GB, state OPTIMAL, flags ENABLED
ioc0 phy 1 scsi_id 11 ATA      HUA721075KLA330  AB4A, 698 GB, state ONLINE, flags NONE
ioc0 phy 0 scsi_id 10 ATA      HUA721075KLA330  AB4A, 698 GB, state ONLINE, flags NONE

Getting email reports on status change

First we need to get the kernel module to load at boot. It get achieved  by editing /etc/modules and adding mptctl to the end of that file. Then reboot your server. After reboot, mpt-status -p command should work.

Next create an  /etc/default/mpt-statusd file and paste in:

MAILTO=root  # Where to report problems
PERIOD=600    # Seconds between each check    (default 10 minutes)
REMIND=7200   # Seconds between each reminder (default 2 hours)

Change the value as you wish. Be care to set the correct ID (the number from the command mpt-status -i 9 , for me it is 9)

You then need to set the daemon to run at boot:

sudo update-rc.d mpt-statusd enable

And fially start it:

sudo service mpt-statusd start

You are done and you will receive an email alert when the RAID status changes.

Setup the brother DCP-357C in Ubuntu

I had a problem where the printer was cutting the top edge of every page using Ubuntu’s brother-lpr-driver-extra & brother-cups-wrapper-extra.

So I downloaded the packages from brother web site. The package are not really wellll done so a couple of hacks are needed. First download the the debs from here

Then issue those commands:

# sudo mkdir -p /usr/share/cups/model
# sudo mkdir -p /var/spool/lpd/dcp353c
# sudo dpkg -i --force-all dcp353c*

A last command is necessary to not have the top of each page cut off:

# sudo /usr/bin/brprintconf_dcp353c -pt A4

For the scanner download the files from here and then:

# sudo dpkg -i brscan*

Then you have to give the scanner some permissions:

# gksudo gedit /lib/udev/rules.d/40-libsane.rules

and add this to the end of the hardware list of the file:

#Brother DCP-357C
ATTRS{idVendor}==”04f9″, ATTRS{idProduct}==”01e4″, ENV{libsane_matched}=”yes”

And finally restart udev:

# sudo service udev restart