one of many in the wild, wild net.
O C K E T S . N E T » Archive of 'Sep, 2007'

I learned something new today. Click here to comment

So I stumbled upon not one but two intentionally half-completed comments on digg today. Never failing to sense a pattern when I see one (usually), I looked into this further. I had only one clue… the name “candlejack“. It seems that when you say his name you get kidna

Happy International Talk-Like-A-Pirate Day! Click here to comment

YARRRR! I hope ye be havin’ yerself a grand day of lootin’ an plunderin’!

Be shure to visit http://www.talklikeapirate.com/ if’n ye don’t know what I be talkin about.

Anchors away!

-TJ the pirate (for a day)

Ding. Click here to comment

In the grand scheme of life, this guy just gained a level.

My first script 1 comment

So I’ve been dicking around with my linux ubuntu server. I installed postfix and courier-imap to set up an IMAP server on my network so whenever I feel like switching email clients I don’t lose all my mail. Well, the first thing I apparently have to do is make sure postfix is working right, and that involves configuring my /etc/postfix/main.cf file.

So I start looking into it, and come to a part where I have to list my external IP address as part of the config file so some kind of loop doesn’t happen. Well… how do I automate this? Here’s the script I eventually came up with:

sed ’s/^proxy_interfaces = .*$/proxy_interfaces = ‘`wget -qO- http://checkip.dyndns.org | html2text | cut -c21-35`’/’ /etc/postfix/main.cf > /etc/postfix/main.cf.tmp

mv /etc/postfix/main.cf /etc/postfix/main.cf.old

mv /etc/postfix/main.cf.tmp /etc/postfix/main.cf

/etc/init.d/postfix restart > /dev/null

I know it doesn’t show up right, but the first line starts from sed and ends with “> /etc/postfix/main.cf.tmp”, and what it does is query that web address which returns my IP as seen from the outside, then replaces the string “proxy_interfaces = blah blah blah” with a correct string that states what my IP address is from the outside. Anyway, I stuck this script in my cron.hourly folder so each hour it gets my external IP and updates my postfix main.cf file accordingly, rebooting my postfix daemon silently after each update.

I know my Linux kung-fu is weak, but I consider this a step towards mastery of my OS.

Today: shell scripts. Tomorrow: kernel programming… again! Just call it the “re-education of TJ O”

-TJ

Top of page / Subscribe to new Entries (RSS)