Archive for the ‘System Administration’ Category

This patch is indented for people who run QMail for personal mail hosting and want to route all outgoing mail through there ISP smtp server. The reason to route outgoing mail through you ISP is that some smtp servers won’t accept mail from dynamic ip addresses. To do this in QMail you configure smtproutes control file to direct all outgoing mail to your ISP’s smtp server (see man qmail-remote(8)). However, some ISPs require SMTP authentication for outing mail which qmail doesn’t support. This patch provides support for SMTP authetication.

Build

  • Apply the patch to the code.
  • Follow the normal build process for making QMail.
  • If the same qmail verision is already installed via a package you can copy over just the qmail-route binary, you won’t need to install the complete built version

Configure

smtpauth – create this file in your control directory and put you ISP’s username in it. The username must be base64 encoded. To do this you can use this website to get the base64 encode string. Enter you username and click encode. Copy the result to this file

smtppasswd – create this file in your control directory and put you ISP’s password in it. The password must be base64 encoded. To do this you can use this website to get the base64 encode string. Enter you password and click encode. Copy the result to this file

Issues

  • There a know issues that the smtpauth file must exist. If it doesn’t qmail-route will crash.is file

Living in Southern California without A/C I’m always a little worried about the temperature inside my computer cases.  I just rebuilt a system and forgot to plug in the 120mm fan in front of the drives.  When I opened the case up to reconnect the fan the hard drives where scorching hot.  After rebooting I checked the drive temperatures using hddtemp, 59C-66C.  Ouch!  Now with the fan connect, the drives are 42C-48C.

Nothing kills a drive faster then heat, so I decided to start monitoring them.   Here is a script that uses hddtemp to monitor the drive temperature and send out an alert and if the drive reaches critical condition will shut the machine down. To install hddtemp on Ubuntu run: sudo apt-get install hddtemp

#! /bin/bash

#List of devices to monitor
DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf"

#Email address to send alerts to
SYSADMIN=email@address.net

#Mail program
MAIL="/usr/bin/mail"

#Alert temperature before sending alerts
ALERT_TEMP="60"

#Max temperature before shutting down down
KILL_TEMP="65"

SHUTDOWN_CMD="/sbin/shutdown -h now"

for HD in $DEVICES
do
    TEMP=`/usr/sbin/hddtemp -n $HD`
    logger "Checking temperature on $HD... ($TEMP C)";
    if [ "$TEMP" -gt "$ALERT_TEMP" ]; then

        DATA=`/usr/sbin/hddtemp $HD`
        HOSTNAME=`hostname`
        MSG="$HOSTNAME Drive temperature critical"
        #
        (
        echo " "
        echo "$DATA"
        echo " "
        ) | $MAIL -s "$MSG" $SYSADMIN
    fi;

    if [ "$TEMP" -gt "$KILL_TEMP" ]; then
    $SHUTDOWN_CMD
    fi;

done

The following added to cron.d runs the script every 5mins.

*/5 * * * * root /usr/local/bin/hddtemp.sh