Linux

I've run into this enough times that I thought I'd write a little script to do the work for me.
It's just a simple one line call to python, but I wrapped it with some argument parsing.

It's a python script that takes a password and returns the salted sha512 hash by default. sha256 and md5 can be specified with switches.

The script is hosted at github here.



We maintain multiple repositories, many of which have the same rpms repeated in different locations. In order to save space we use hardlinking extensively. The hardlink command does an ok job of finding things to link, but we are only really interested in rpms and don't want repomod.xml or comps getting linked so I wrote a little python script to hard link all the rpms based on a checksum. The script is over at my github. hardlink_rpms



When using an mdbox or maildir mailbox, you need to use the dovecot-lda to deliver the message and not allow procmail to do this directly. I had a few issues getting this to work properly, here are the details of getting it going.

The first issue is that my procmail transport in exim needed to set user to the local_part and do initgroups to get the uid and gid of the localuser, then run procmail as that user/group. Here is that transport:


procmail_pipe:
driver = pipe
command = /usr/bin/procmail -d $local_part
…



Our aliases are spammed like any other account, but filtering on them would require making a real account. I wanted to be able to filter aliases without creating accounts for everything. My first solution was to create an account and filter on that one, then using $original_local_part I could forward to a filtered alias. This works but if someone discovers the filtered alias, they can bypass the filtering.

The exim docs suggested that I could have filtering in the aliases but it didn't seem to work and I kept getting this in the logs:

error in redirect data:…



We are using gnarwl for vacation notification and I would like gnarwl to only reply if the current time is in the vacationStart vacationEnd window.

Here is the queryfilter to do that using the following information:


$recepient - receiver of the message
$time - current time in seconds since the epoch
vacationActive - attribute for start time of the vacation in seconds since the epoch
vacationEnd - attribute for end time of the vacation in seconds since the epoch
mail
mailAlternateAddress - attribute for…



I often use dd to copy large files or make images from hard drives. It's annoying to watch something without any progress indicator, so I use the little known kill switch on dd.

From the man page:

Sending a USR1 signal to a running ‘dd’ process makes it print I/O statistics to standard error and then resume copying.

$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid

I'll often make a for loop and keep killing dd to get the stats, I decided to make a little script to do the…



We have a watchport/w sensor and I wanted to start monitoring it with zabbix. I did a little googling and the only thing this sensor does is set the DCD line on a usb modem to high when there is water, otherwise it's low (not connected).

I couldn't find anything to test for the carrier easily (cu maybe, but it seems a bit clumsy). I found on the tty_ioctl man page the code to do this in C, so I just modified it and made a little app to check the port.


EXAMPLE (from tty_ioctl manpage)
Check the condition of DTR on the serial port.…



I wanted to monitor the ambient temperature in my computer room and decided to try using the built in sensors on my servers. ipmitool showed an ambient temperature, so I did some sed to get just the temperature.


[thomas@hotstuff: ~] $ sudo ipmitool sdr type "Temperature" |grep Ambient
Ambient Temp | 08h | ok | 7.1 | 22 degrees C

Some of my machines have multiple Ambient Temperature sensors, I did some looking on the google and the ones marked 7.1 appear to be the one to look at, the rest are power supply temp sensors…



A talk I gave at PICC 12 on mock

Slides available here