Ever need to install packages or get internet access on a server without internet access? Check out this ingenious post for dealing with the situation. If you can ssh to the server then you can use your internet access over ssh using tsocks.
I’ll leave it as an exercise for the reader to come up with more interesting ways to use tsocks.
The easiest way to send an email from a Linux command line is this:
mail -s subject email@example.com < /dev/null
Sometimes you need to specify the from address, but I'm always forgetting the syntax.
echo "The message" | mail -s "The subject" firstname.lastname@example.org -- -f email@example.com
Very cool way to visualize you web traffic. It takes a little work to get installed, but it is definitely cool. Check out the video to see it in action.
I was trying to compile ArcEMU on Fedora and I kept geting the following error:
configure: error: Couldn’t find pcre library. Make sure your pcre path is correct.
Turns out if you don’t have the mysql-devel packages installed you get this error. That makes a lot of sense. After an hour of searching the web and building pcre over from scratch a dozen times, I finally found a post that mentioned a problem with using mysql-devel 64bit packages. I checked and didn’t have mysql-devel installed, so I installed it and it compiles just fine now.
I’ve been slacking on the posts recently. There has been a lot going on. I’ve switched jobs and I’m now working for E.W. Scripps’ Online Division. E.W. Scripps is newspaper company based in Knoxville and also formally part of HGTV, FOOD Networ, etc. I was brought on to help split out the web servers during the company split.
We’ve made a lot of progress on getting things running more effeciently. We’ve recently upgraded from Postgres 8.1.3 to 8.3.3 which made a huge improvement. Even though Postgres claims that writes don’t block reads and reads don’t block writes, we were seeing a lot of processes getting hung waiting on a commit to finish. I think that it was having problems starting a new transaction while a transaction was commiting. Postgres 8.3 introduced asyncronous commits, so that we no longer have to wait for everything to be flushed to disk before we received the commited status. Now we immediately get a commited status and transactions are written to disk as they can be.
This has been a HUGE performance gain for out database. Before we had seem the database hit loads over 300 while getting Drudged. Now we never see the database get above a load of 10, they ususally over around 3 to 4.
Next we will be working on clustering Postgres. I have evaluated CyberCluster, PGCluster, Slony, PGPoolII and Sequoia. The only one that seems to be reliable and meet our needs has been Sequoia, so we will see how that goes.
Oh, and I’ve also got a new MacBook Pro. More on that latter.
Ever been frustrated by a processes that you could not kill on a Linux box? I know I have, especially working with Samba and NFS. Good news, there is a new sleep state that will help eliminate the problem and more code makes use of it. In fact most of the NFS code has already been converted. Check out the link here and read more about it: http://lwn.net/Articles/288056/
I’ve tried the firefox 3 beta a couple times on my linux box. Every time I try it the fonts and toolbars are obnoxiously big. I couldn’t find any help on this. It seemed like a dpi issue, so I went to about:config and searched for dpi. There it was layout.css.dpi. Mine was set to -1, I changed it to 150 which seemed about right.
Type about:config in you browser window. Then type dpi in the filter text box and double click the layout.css.dpi to change the value. I changed mine to 150.
Two things I ran across today that I need to look further into.
http://latencytop.org/ – This shows what processes are waiting on and looks very interesting.
The other is Group Scheduling in Linux 2.6.24 and above. This allows you to put processes in a group so that one set of processes can share the same resources. For example, you can assign two different users 50% of the processor and one use could be running 50 compiles but should not affect the performance of the second user.
As I said in my previous post, I learned a couple things about bash today. I had a nice for loop that outputted the info I wanted, but not in the right order. I thought to myself, man if this were php I would just put it in an array and sort it before looping across it. I bet this will be a pain in bash.
BUT, I was pleasantly surprised to find out how simple this really was. If you want to perform an action the output of a loop in bash then you just pipe done into the fuction you want performed. See the example below.
for VAR in $VARS; do
done | sort -n
Learned a couple things about bash today. I was wanting to print something out nicely, so I was using tabs to separate fields. As you know, nothing ever lines up if you do not have values very similar in size. So I was about to search Google for the problem when I had a moment of sheer brilliance. 🙂 I thought I’ll just concatenate a bunch of spaces on the end of the variable and then use cut to grab how many characters I want. I was very proud of myself, but then bash quickly humbled me by condensing all my spaces I had added to the variable.
So, back to the all knowing Google. Turns out you have to quote your variable when you use it if you don’t want bash to truncate the spaces. So I quoted my variable when using it and all is good.
NICE_VAR=`echo "$VAR" | cut -c -15`
echo "$VAR $VAR2"