Archive for category Linux

Ubuntu codenames, my own cheat sheet, rant, and link

I love Ubuntu.

I use it everywhere. I love the Debian based dpkg, the default installs, the Amazon AWS compatible EUC cloud.

I’m also a big fan of cool names, I like having printers and domains and whatever on some big, geeky, internal naming schema, like everything relates to Norse mythology or Star Trek.

But, I CANNOT STAND the code names for Ubuntu projects being used to refer to the version. I’m running Ubuntu 9.04, or 8.04 LTS, or 10.04 LTS, etc. I am not running Ubuntu Honey Badger, or whatever code name they developed under.

This is only annoying when I’m trying to find instructions about how to do something and people say things like  ’Well, I tried this and it worked on Hoary’. WTF is a Hoary? Please, don’t tell me, I don’t care.

So, for my own sanity I am posting this rant, and linking to the page with a list of Development Codes for Ubuntu, as I’m sure, going forward, I’m going to need it.

https://wiki.ubuntu.com/DevelopmentCodeNames

And for my quick use, the versions I use most:

8.04 Hardy Heron

9.04 Jaunty Jackalope

10.04 Lucid lynx

11.04 Natty Narwhal

 

, , , ,

No Comments

Quick remote SMTP page script in Python

Disclaimer : You own what you do with this script, and are responsible for it. This script could cause problems with SMTP / mail server administrators, and you should be sure to get any use approved. I make no claims about the scripts fitness for any specific use.

I have several servers that are not allowed to communicate with the outside world. Often times this helps a lot, but it can be a pain when trying to send e-mail alerts. Combine that sometimes I’m not root on these boxes so I can’t simply change the postfix/exim/qmail/sendmail default relay server to something.

The work around is this script, which uses a hard coded SMTP server, so you’ll need to edit the script to change the from, to, and the smtp servers IP.

I haven’t set it to take arguments, as I rarely re-use it for different things. Let me know if you’d benefit from that and I’ll throw them in.

Here is the script in gzipped format

Here is the code of the script :

#!/usr/bin/python
#Author : jon@jonzobrist.com
#License : BSD/public/freeware

import smtplib
import sys

def prompt(prompt):
return raw_input(prompt).strip()

fromaddr = “noreply@example.com”
#toaddrs = ['userA@example.com','userB@example.com','Phone1@txt.att.net','Phone2@txt.att.net','userC@example.com']
toaddrs = ['userA@example.com']
subject = “[ALERT] Alert from localhost”

msg = (“From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n”
% (fromaddr,toaddrs,subject))
msg = msg + sys.argv[1]
server = smtplib.SMTP(‘server.ip.or.hostname’)
#server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

 

Enjoy!

, , , , , , ,

No Comments

My EC2 EBS RAID-0 creation script

I want to write up a full howto/tutorial, but have not had the time.

Here is the script that I referred to in my post at http://www.jonzobrist.com/2011/04/16/ec2-raid0-on-linux-with-ebs-volumes-notes/

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License HERE for more details.

http://www.jonzobrist.com/files/setup-ec2-raid-0.zip

http://www.jonzobrist.com/files/setup-ec2-raid-0.sh.gz

This script needs an AWS command line setup, and may need some minor tweaking if you’re not running a Ubuntu server.

Ubuntu’s latest AMI’s are available for 10.04 here.

Please feel free to submit patches, comments, or questions.

Thanks to everyone whose helpful posts online and in the AWS forums helped me with this script. I could not have done it with out your generous sharing of work.

Enjoy!

 

, , , , , , , , , , ,

No Comments

Getting started with Chef.

I write a lot of scripts, configure a lot of systems, and do a lot of snapshot related backup/restore/sync stuff on servers in house, and in the cloud.
Chef is a Ruby-based configuration management engine. There is a good intro here.

I set up a Chef Server. There’s a good overview here.

I followed the instructions to setup a Chef server from this Wiki on Opscode.

I also referred to the information from Grig Gheorghiu’s blog here.

Now that my server is up, I’m hoping to port my server configurations to Chef, with heavy reliance on EC2 and hopefully UEC.

, , , , , ,

4 Comments

S3-du.sh script to get bucket size on Amazon AWS S3

AWSHere is my script s3-du.sh that I wrote to determine how big a bucket is on Amazon S3. I’m sure there are other ways to skin this cat, but I wrote this and figured I’d share it. Feel free to use it under any free license.

Requires you to have a working s3ls and your Amazon AWS credentials setup already. I use Tim Kays AWS tools.

Links to the file as text, as gzip, as zip.


#!/bin/bash

if [ "${1}" ]
then
NUM=0
COUNT=0
for N in `s3ls ${1} | awk ‘{print $11}’ | grep [0-9]`
do
NUM=`expr $NUM + $N`
((COUNT++))
done
KB=`expr ${NUM} / 1024`
MB=`expr ${NUM} / 1048576`
GB=`expr ${NUM} / 1073741824`
echo “${COUNT} files in bucket ${1}”
echo “${NUM} B”
echo “${KB} KB”
echo “${MB} MB”
echo “${GB} GB”
else
echo “Usage : ${0} s3-bucket”
exit 1
fi

, , , , , ,

No Comments

Finally On EC2

I can’t believe it took me this long to nut-up and just do it. GoDaddy’s shared hosting “premium plans” are a joke in speed compared to a free micro instance on EC2. I did have an overage charge of $.01 last month. I expect that to go up as I start doing daily snapshots, S3 MySQL binlog syncs, and maybe some actual traffic. Who knows, I may end up owing DOLLARS each month for awesome performance in the real cloud.

DSC_4012.JPG

, , , ,

2 Comments

LCOD – 7.24.10 – Get su to respect /etc/security/limits.conf

Get su to respect settings in /etc/security/limits.conf

Click to continue reading “LCOD – 7.24.10 – Get su to respect /etc/security/limits.conf”

, , ,

1 Comment

LCOD – 7.7.10 – Rebuilding and checking a Linux software RAID array

Recovering an unclean ext3 or reiserfs partition when it’s on a software RAID array in Linux – HOWTO.

Click to continue reading “LCOD – 7.7.10 – Rebuilding and checking a Linux software RAID array”

1 Comment

LCOD – 5.26.10 – Compare 2 directories

md5sum * | md5sum

This will return an md5sum which will look something like
9277826461d2cb19731f6201c6b2c6b3 -

Run it in 2 directories, if the sums of the sums match, the files are identical.
If not, you may want to rsync between them with something like
rsync-avz -e ssh localdir/ user@remotehost:/remotedir/
or
rsync-avz -e ssh user@remotehost:/remotedir/ localdir/

, , , , ,

No Comments

LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup

This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at hackmysql.com

Click to continue reading “LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup”

, , , , , , , ,

No Comments