Roxio Toast Titanium on Mac OS X opening / running very slow – hello DTrace!

ToastIf you find Toast is running very slow on your Mac and you've tried all the other fixes, check to make sure you don't have any mounts defined on your Mac as Toast will continue to try and mount them ad nauseum – thereby causing the slowness.  You can check Directory Utility to see if there are mounts you forgot about.

If that's not it, it is time to embrace the built-in DTrace tools Mac has for your computing pleasure.  This can help you track the calls Roxio makes when it's appears to be running dog slow.

Dtruss is very much like truss or strace – it will show you system calls made by whatever you are dtrussing.  If what you are trying to figure out is shortlived, execsnoop is also your friend as it will show you system calls for any new processes as they are spawned.

Dtruss and execsnoop show when Toast starts up that automountd is always called, thus stale NFS mounts could be causing you headaches.

Simple Bash Scripting – Case Statement

Angry-bird-red-toy For the RHCE test you are probably going to want to know how to write a simple bash script which employs a simple case statement.

Note that the ")" symbol is used to separate the list of selections from the action to be taken. Fall through is done using *, which catches all input that has not been specificed previously. Also ;; acts as a case break.

Note that the statement is started with “case” and closed with “esac

[code language=”css”]
#!/bin/bash
    case "$1" in
this)  echo "this"
;;
that) echo "that"
;;
*) echo "Type this or that"
esac

[/code]

Using ssh-copy-id to Push SSH key to Authorized Keys

f44d3-6a00e551c39e1c88340162fcbcab43970d-piEverywhere I have ever worked we have always used complex scripts to push out id files to enable passwordless authentication from a bastion host. Today I stumbled across ssh-copy-id which is about as easy to use as it gets.

Check out the section below for usage and substitute your servers hostname where you see <yourhost>

# ssh-copy-id -i ~/.ssh/id_rsa.pub <yourhost>

You will get output similar to what is shown below.

Now try logging into the machine, with “ssh ‘<yourhost>'”, and check in:

  .ssh/authorized_keys

to make sure we haven’t added extra keys that you weren’t expecting.

Checkout the link below for more info

http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/#more-268

Below is a little wrapper script that I use to make using ssh-copy-id even easier. Please feel free to borrow it for a bit.

[code language=”css”]
#!/bin/bash

echo "Please Enter Server Name :"
read servername
ssh-copy-id -i ~/.ssh/id_rsa.pub $servername
[/code]

Quick and Dirty Sed Replace Command

Prodshot_170x190 Had to move my corporate kickstart server to a new vlan and re-ip it this past week. As a result I needed to update my kickstart config files so that they know where to look for the install media. Instead of editing each file directly I did the following to change the IP address in a kickstart config

sed -i ‘s/10.100.x.x/10.1.x.x/g’ centos5-u4_x86_64.cfg.

Once I saw that the command above worked as anticipated, I then ran the same command but on each cfg file in the directory. Syntax below

find . -type f -exec sed -i ‘s/10.100.x.x/10.1.x.x/g’ {} \;

Shell Script: List all RPMs and their Requirements on RHEL

 The command below is sort of like a fingerprint for a box. It lists all rpms that are installed and the files that are required by those rpms.

rpm -qa | sed -e "s,-[0-9]*\\., ,1" | tee rpm-qa.txt | awk '{print $1}' | xargs rpm -q –requires | sort | uniq | tee rpm-qa-requires.txt

Shell Script: Test SSH Connectivty to a list of boxes

#!/bin/ksh

ERROR=0

for SERVER in `cat server.list`
do
        ssh -n -o Batchmode=yes -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $SERVER "uname -n > /dev/null" > /dev/null 2>&1
        if [ $? -ne 0 ]
        then
                echo "FAILED: $SERVER"
                ERROR=1
        else
                echo "SUCCESS: $SERVER"
        fi
done

Shell Scripting – Prompting for User Input.

Shell_25194_sm First off let me start out this post by stating that I am a pretty lousy scripter. I just have not taken the time to write a lot of scripts. So I have created a new Category called "Shell Scripting" and plan to do my best to keep adding little "scriptlets" whenever I can.


Prompting for user input

# echo -n "Enter your name and press [ENTER]:"
# read name
# echo -n "Enter your gender and press [ENTER]:"
# read -n 1 gender (read returns after 1 character is read)
# echo