Tuesday, 9 August 2011

Quick Sendmail Cheatsheet

We received a support ticket today for a mail server that hasn't been working since July, yes, they noticed today... It's only used for mail from their website but managed to build up a queue of 3916 messages, so I figured it might be nice to blog a cheatsheet for sendmail:

Attempt to send messages by flushing the queue:
sendmail -q

See the entire queue:

Fast way to print how many messages are in the queue:
mailq –OmaxQueueRunSize=1

Delete all the e-mails in the queue without timing out any messages:
sendmail –q –Otimeout.queuereturn=99d

Delete from a specific sender:
sendmail -qS -v example.com

Delete to a specific recipient:
sendmail -qR -v example.com

Wednesday, 3 August 2011

Ubuntu - changing screensaver settings from terminal!

Every now and again someone calls me for support regarding their screensaver, usually after playing around with the settings... To save you some time, heres a mini howto:

The settings are all stored in a database, to view the database and descriptions of each key, run the command: gconf-editor

The actual screensaver settings for Ubuntu 10.04.3 LTS:

gconftool --set /apps/gnome-screensaver/lock_enabled --type bool 0
gconftool --set /apps/gnome-screensaver/idle_activation_enabled --type bool 1
gconftool --set /apps/gnome-screensaver/mode --type string random

The config above also helps avoid that auto-lock screen feature after installing Ubuntu and is perfect for those preseed installs too!

Tuesday, 2 August 2011

Seagate BlackArmor Update

The last blog post I wrote on the Seagate BlackArmor ended along the lines of "rather buy something else", this unfortunately hasn't changed. My uncle removed drive no. 4 from the span on his NAS yesterday while it was running, the NAS freaked out and marked the volume as failed with no hope in hell of ever working again...

I got another chance to view the NAS from another angle, we hooked all the drives up to a system and I loaded my trusty Ubuntu 10.4.3 LTS disk, what I found was pretty interesting...

The Seagate BlackArmor device creates a Linux software RAID, yes, no hardware RAID as expected... shame on you Seagate (or Maxtor as the device claims on some hardware parts). The spanning created a RAID 1 /dev/md device.... Long story short I was able to reassemble the entire RAID device, with the mdadm command:

To stop all software RAID's:
mdadm --stop --scan

To assemble them, you can do something like this:
mdadm -A -R --force /dev/md0 /dev/sda4 /dev/sdb4 /dev/sdc4 /dev/sdd4

To view the status:
cat /proc/mdstat

The partition however is of an unknown type, the next challenge awaits!