<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-2383541800224195596</id><updated>2008-10-23T09:53:22.205-04:00</updated><title type='text'>Jason Noble's Technical Adventures</title><subtitle type='html'></subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jasonnoble.org/atom.xml'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-4712411934947062535</id><published>2008-09-20T20:17:00.003-04:00</published><updated>2008-09-20T20:28:31.724-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><category scheme='http://www.blogger.com/atom/ns#' term='textmate'/><title type='text'>Making TextMate recognize .html.erb files</title><content type='html'>I'm using &lt;a href=http://macromates.com/&gt;TextMate&lt;/A&gt; to edit some Ruby on Rails code.  I noticed that when I edit the view pages (i.e. index.html.erb) it does not do syntax highlighting.  It turns out this is because the Ruby on Rails TextMate bundle thinks that ruby view pages are .rhtml, which is the old Ruby on Rails format.&lt;P&gt;

You can fix this by editing the Ruby on Rails language bundle.&lt;P&gt;

In TextMate, select Bundles -&gt; Bundle Editor -&gt; Edit Languages.&lt;P&gt;

This will open a new Bundle Editor Window.  Click the arrow next to Ruby on Rails and highlight HTML (Rails).  In the code that appears on the right, change the following

&lt;pre&gt;
fileTypes = ( 'rhtml');
&lt;/pre&gt;

to

&lt;pre&gt;
fileTypes = ('rhtml', 'html.erb');
&lt;/pre&gt;

Click the red X in the upper left corner to close the Bundle Editor Window.&lt;P&gt;

Close any existing .html.erb files, when you open them again, they will have ruby syntax highlighting.&lt;P&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/4712411934947062535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=4712411934947062535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4712411934947062535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4712411934947062535'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/making-textmate-recognize-htmlerb-files.html' title='Making TextMate recognize .html.erb files'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-768136450775904410</id><published>2008-09-14T11:40:00.001-04:00</published><updated>2008-09-14T11:42:33.086-04:00</updated><title type='text'>Adding an alias to the Tcsh Shell</title><content type='html'>If you run a command frequently, you can create what is called an alias.  The alias is usually a shorter form of the original command.

To make these aliases permament, you should edit .tcshrc in your home directory.

&lt;pre&gt;
11:32:07 /Users/jasonn $ vi ~/.tcshrc
&lt;/pre&gt;

Add a line of text of the format "alias YYY 'ZZZ'" where YYY is the command you want to type in, and ZZZ is the command you want to be run.  

Examples:

&lt;pre&gt;
# Show long listing
alias ll 'ls -al'

#  Use VI Improved instead of Vi
alias vi 'vim'     

 # Change into your web directory
alias web 'cd /usr/local/apache/vhosts/jasonnoble.org/htdocs'
&lt;/pre&gt;

This alias ability allows you to type less at your shell prompt.  If you find yourself typing the same long command line over and over, try adding an alias to your shell that will save you some time.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/768136450775904410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=768136450775904410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/768136450775904410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/768136450775904410'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/adding-alias-to-tcsh-shell.html' title='Adding an alias to the Tcsh Shell'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-5352543595453538844</id><published>2008-09-14T11:28:00.004-04:00</published><updated>2008-09-14T11:39:32.948-04:00</updated><title type='text'>Adding an alias to the Bash Shell</title><content type='html'>If you run a command frequently, you can create what is called an alias.  The alias is usually a shorter form of the original command.

To make these aliases permament, you should edit .bashrc in your home directory.

&lt;pre&gt;
11:32:07 /Users/jasonn $ vi ~/.bashrc
&lt;/pre&gt;

Add a line of text of the format "alias YYY='ZZZ'" where YYY is the command you want to type in, and ZZZ is the command you want to be run.  

Examples:

&lt;pre&gt;
# Show long listing
alias ll='ls -al'

#  Use VI Improved instead of Vi
alias vi='vim'     

 # Change into your web directory
alias web='cd /usr/local/apache/vhosts/jasonnoble.org/htdocs'
&lt;/pre&gt;

This alias ability allows you to type less at your shell prompt.  If you find yourself typing the same long command line over and over, try adding an alias to your shell that will save you some time.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/5352543595453538844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=5352543595453538844' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/5352543595453538844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/5352543595453538844'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/adding-alias-to-bash-shell.html' title='Adding an alias to the Bash Shell'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-4716058113923106443</id><published>2008-09-10T09:21:00.002-04:00</published><updated>2008-09-10T09:21:58.306-04:00</updated><title type='text'>Free Online Books</title><content type='html'>A co-worker pointed me to a bunch of free online &lt;a href=http://www.linuxtopia.org/online_books/index.html&gt;books&lt;/a&gt;.  Looks pretty cool, I'll have to check a couple of them out.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/4716058113923106443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=4716058113923106443' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4716058113923106443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4716058113923106443'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/free-online-books.html' title='Free Online Books'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-4471693872444885396</id><published>2008-09-03T13:46:00.001-04:00</published><updated>2008-09-03T13:48:02.448-04:00</updated><title type='text'>Google Chrome first experience</title><content type='html'>I just installed Google &lt;a href=http://www.google.com/chrome&gt;Chrome&lt;/a&gt;, a new web browser by Google.

Below is my first experience:

&lt;IMG SRC=/images/google_chrome.jpg&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/4471693872444885396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=4471693872444885396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4471693872444885396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4471693872444885396'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/google-chrome-first-experience.html' title='Google Chrome first experience'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-3088502554314956342</id><published>2008-09-02T19:23:00.015-04:00</published><updated>2008-09-02T21:13:51.797-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><category scheme='http://www.blogger.com/atom/ns#' term='vsftpd'/><category scheme='http://www.blogger.com/atom/ns#' term='postgres'/><category scheme='http://www.blogger.com/atom/ns#' term='pam'/><title type='text'>Allow rails users to login via vsftpd</title><content type='html'>So you've &lt;a href=http://jasonnoble.org/2008/09/installing-ruby-on-rails-in-freebsd.html&gt;installed&lt;/a&gt; Ruby on Rails with Postgres, and now you want to allow your users to login to your server via FTP.

First we need to install our FTP server.  (In the config window, I left the defaults)

&lt;pre&gt;
freebsd-vm# cd /usr/ports/ftp/vsftpd
freebsd-vm# make install 
cd /usr/ports/ftp/vsftpd &amp;&amp; make config;
[...]
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage: 
http://vsftpd.beasts.org/
freebsd-vm#
&lt;/pre&gt;

Edit the vsftpd conf file.

&lt;pre&gt;
#vi /usr/local/etc/vsftpd.conf
# Remove all lines and replace with the following
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
virtual_use_local_privs=YES
write_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
pam_service_name=vsftpd
guest_enable=YES
user_sub_token=$USER
local_root=/usr/local/www/apache22/data/$USER
chroot_local_user=YES
hide_ids=YES
ftpd_banner=Welcome to FTP server
file_open_mode=0770
local_umask=0000
anon_mkdir_write_enable=NO
guest_username=vsftpd
user_config_dir=/etc/vsftpd/users
&lt;/pre&gt;

Create the vsftpd startup script.

&lt;pre&gt;
# vi /usr/local/etc/rc.d/vsftpd
#!/bin/sh
#
# $FreeBSD: ports/ftp/vsftpd/files/vsftpd.sh.in,v 1.7 2006/02/20 20:47:01 dougb Exp $
#

# PROVIDE: vsftpd
# REQUIRE: DAEMON

# Add the following line to /etc/rc.conf to enable `vsftpd':
#
# vsftpd_enable="YES"
# vsftpd_flags="/some/path/conf.file" # Not required
#

. "/etc/rc.subr"

name="vsftpd"
rcvar=`set_rcvar`

load_rc_config "$name"
: ${vsftpd_enable:="NO"}
: ${vsftpd_flags:=""}

command="/usr/local/libexec/$name"
required_files="/usr/local/etc/$name.conf"
start_precmd="vsftpd_check"

vsftpd_check()
{
 if grep -q "^ftp[  ]" /etc/inetd.conf ${required_files}
 then
  err 1 "ftp is already activated in /etc/inetd.conf"
 fi
 if ! egrep -q -i -E "^listen.*=.*YES$" ${required_files}
 then
  err 1 "vsftpd script need "listen=YES" on config file"
 fi
 if ! egrep -q -i -E "^background.*=.*YES$" ${required_files}
 then
  err 1 "vsftpd script need "background=YES" on config file"
 fi
}

run_rc_command "$1"
&lt;/pre&gt;

We also need to install the Postgres PAM module.

&lt;pre&gt;
freebsd-vm# cd /usr/ports/security/pam-pgsql/
freebsd-vm# make install
=&gt; libpam-pgsql-0.6.3.tar.bz2 doesn't seem to exist in /usr/ports/distfiles/.
=&gt; Attempting to fetch from http://nchc.dl.sourceforge.net/sourceforge/pam-pgsql/.
[...]
to use this module. Note, that unlike most other ports, this port
installs a file into /usr/lib directly (/usr/lib/pam_pgsql.so),
because PAM requires that.
===&gt;   Registering installation for pam-pgsql-0.6.3_1
freebsd-vm# 
&lt;/pre&gt;

We need to tell vsftpd to use pam-pgsql for authentication.

&lt;pre&gt;
freebsd-vm# vi /etc/pam.d/vsftpd
auth    required pam_pgsql.so config_file=/etc/pam_pgsql_vsftpd.conf
account required pam_pgsql.so config_file=/etc/pam_pgsql_vsftpd.conf

freebsd-vm# vi /etc/pam_pgsql_vsftpd.conf
debug
pw_type = md5
connect = hostaddr=127.0.0.1 port=5432 dbname=&lt;font color="red"&gt;sample_development&lt;/font&gt; \
        user=&lt;font color="red"&gt;sample_user&lt;/font&gt; password='&lt;font color="red"&gt;password&lt;/font&gt;' connect_timeout=15
auth_query = select &lt;font color="yellow"&gt;password&lt;/font&gt; from &lt;font color="yellow"&gt;users&lt;/font&gt; where &lt;font color="yellow"&gt;username&lt;/font&gt; = %u
acct_query = select &lt;font color="white"&gt;ftp_disabled&lt;/font&gt; as acc_expired, \
        0 as acc_new_pwreq, (password ISNULL or password = '') as user_password \ 
        from &lt;font color="white"&gt;users&lt;/font&gt; where username = %u

freebsd-vm#
&lt;/pre&gt;

(Long lines above with \ in them should be one long continuous line in your config file)&lt;P&gt;

The configuration above assumes three things:
&lt;UL&gt;
&lt;li&gt;Your rails database name is &lt;font color="red"&gt;sample_development&lt;/font&gt; and can be connected with the username &lt;font color="red"&gt;sample_user&lt;/font&gt; and the password &lt;font color="red"&gt;password&lt;/font&gt; (change red items as needed)&lt;/li&gt;
&lt;li&gt;Your rails users are stored in the &lt;font color="yellow"&gt;users&lt;/font&gt; table.  The password field is &lt;font color="yellow"&gt;password&lt;/font&gt; and the username field is &lt;font color="yellow"&gt;username&lt;/font&gt; (change yellow items as needed)&lt;/li&gt;
&lt;li&gt;Your rails users are stored in the &lt;font color="white"&gt;users&lt;/font&gt; table.  The &lt;font color="white"&gt;ftp_disabled&lt;/font&gt; field holds whether they should be allowed access (false) or denied (true).  (Change white items as needed)&lt;/li&gt;
&lt;/ul&gt;

We need to create the user for vsftpd to run as.

&lt;pre&gt;
freebsd-vm# adduser 
Username: vsftpd
Full name: FTP User
Uid (Leave empty for default): 
Login group [vsftpd]: 
Login group is vsftpd. Invite vsftpd into other groups? []: 
Login class [default]: 
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/vsftpd]: 
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: 
Username   : vsftpd
Password   : &lt;disabled&gt;
Full Name  : FTP User
Uid        : 1002
Class      : 
Groups     : vsftpd 
Home       : /home/vsftpd
Shell      : /usr/sbin/nologin
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (vsftpd) to the user database.
Add another user? (yes/no): no
Goodbye!
freebsd-vm# 
&lt;/pre&gt;

Configure vsftpd to start on boot and manually start vsftpd once.

&lt;pre&gt;
freebsd-vm# echo vsftpd_enable="YES" &gt;&gt; /etc/rc.conf 
freebsd-vm# chmod 755 /usr/local/etc/rc.d/vsftpd
freebsd-vm# /usr/local/etc/rc.d/vsftpd start
Starting vsftpd.
freebsd-vm# 
&lt;/pre&gt;

Now we need to create a couple of users to test this with.  Below we'll create a user bob that can login and a user bob2 that can not login.

&lt;pre&gt;
freebsd-vm$ psql -U sample_rails_app sample_rails_app_development
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

sample_rails_app_development=&gt; select * from users;
 id | username | password | homedir | ftp_disabled | created_at | updated_at 
----+----------+----------+---------+--------------+------------+------------
(0 rows)
sample_rails_app_development=&gt; insert into users (username,password,homedir,ftp_disabled) values ('bob',md5('bob'),'/home/bob',false);
INSERT 0 1
sample_rails_app_development=&gt; insert into users (username,password,homedir,ftp_disabled) values ('bob2',md5('bob2'),'/home/bob2',true);
INSERT 0 1
sample_rails_app_development=&gt; select * from users;
 id | username |             password             |  homedir   | ftp_disabled | created_at | updated_at 
----+----------+----------------------------------+------------+--------------+------------+------------
  2 | bob      | 9f9d51bc70ef21ca5c14f307980a29d8 | /home/bob  | f            |            | 
  3 | bob2     | 436187b1cb437f7ddb11952542e351a4 | /home/bob2 | t            |            | 
(2 rows)

sample_rails_app_development=&gt; \q
freebsd-vm$ 
&lt;/pre&gt;

Next, we need to create bob's virtual home directory (as root).

&lt;pre&gt;
freebsd-vm# mkdir -p /usr/local/www/apache22/data/bob
freebsd-vm# chown vsftpd:vsftpd /usr/local/www/apache22/data/bob
&lt;/pre&gt;

Now we can login as bob (and not bob2).

&lt;pre&gt;
freebsd-vm$ ftp localhost
Trying 127.0.0.1...
Connected to localhost.
220 Welcome to FTP server
Name (localhost:jasonn): bob
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp&gt; pwd
Remote directory: /
ftp&gt; quit
221 Goodbye.
freebsd-vm$ ftp localhost
Trying 127.0.0.1...
Connected to localhost.
220 Welcome to FTP server
Name (localhost:jasonn): bob2
331 Please specify the password.
Password:
530 Login incorrect.
ftp: Login failed.
ftp&gt; quit
221 Goodbye.
freebsd-vm$ 
&lt;/pre&gt;

Now we need a script that will setup the FTP user's home directory.  (Run this in your Rails project's home directory)

&lt;pre&gt;
freebsd-vm# echo "User.write_ftp_configs" &gt;&gt; write_ftp_configs
freebsd-vm#
&lt;/pre&gt;

Change the User model in your Rails application

&lt;pre&gt;
freebsd-vm$ vi app/models/user.rb 

class User &lt; ActiveRecord::Base
  require 'ftools'

  def self.write_ftp_configs
    User.find(:all, :conditions =&gt; ["ftp_disabled is false"]).each do |user|
      unless File.directory?(user.homedir)
        # If their home directory doesn't exist, create it
        # and chown the directory to vsftpd (1002)
        File.makedirs user.homedir
        File.chown(1002, 1002, user.homedir)
      end
      if File.directory?("/etc/vsftpd/users")
        unless Dir.entries("/etc/vsftpd/users").include?(user.homedir)
          File.open("/etc/vsftpd/users/#{user.username}", 'w') {|f|
            f.write("local_root=#{user.homedir}\n");
          }
        end
      end
    end
  end
end
&lt;/pre&gt;

Now you just need to setup a cronjob to run as root.  This script should cd to your rails root directory and run "script/runner write_ftp_configs".  &lt;P&gt;

&lt;font color="red"&gt;WARNING&lt;/font&gt;:  There may be security implications with this script.  If a user has their homedir set to something "sensitive" this script will create that directory for them.  Make sure you trust anyone that can add users via your Rails application.  You could fix this by adding a validation on the homedir field so that it's only a subdirectory of a given directory (i.e. $RAILS_ROOT/upload) or something.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/3088502554314956342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=3088502554314956342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/3088502554314956342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/3088502554314956342'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/allow-rails-users-to-login-via-vsftpd.html' title='Allow rails users to login via vsftpd'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-2678614208649645686</id><published>2008-09-01T23:09:00.008-04:00</published><updated>2008-09-02T19:19:49.280-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><category scheme='http://www.blogger.com/atom/ns#' term='postgres'/><title type='text'>Installing Ruby on Rails in FreeBSD with Postgres</title><content type='html'>After setting up a minimal FreeBSD &lt;a href=http://jasonnoble.org/2008/09/setting-up-freebsd-vm-with-parallels.html&gt;install&lt;/a&gt;, I want to get Ruby on Rails up and running.

Let's see what's available in the ports tree.

&lt;pre&gt;
freebsd-vm# make search key=gem | grep Path: | grep ruby
Path: /usr/ports/audio/rubygem-mp3info
Path: /usr/ports/benchmarks/rubygem-railsbench
Path: /usr/ports/databases/ruby-dbd_pg
Path: /usr/ports/databases/ruby-rdbc1
Path: /usr/ports/databases/rubygem-activerecord
[...]
Path: /usr/ports/devel/ruby-gemfinder
Path: /usr/ports/devel/ruby-gems
Path: /usr/ports/devel/rubygem-activesupport
[...]
Path: /usr/ports/www/rubygem-scrubyt
Path: /usr/ports/www/rubygem-taggable
freebsd-vm# 
&lt;/pre&gt;

The ruby-gems port looks promising.

&lt;pre&gt;
freebsd-vm# cd devel/ruby-gems
freebsd-vm# cat pkg-descr 
a package management framework for the Ruby programming language
An application or library is packaged into a gem, which is 
a single installation unit. 
RubyGems entirely manages its own filesystem space, rather 
than installing files into the "usual" places. This enables 
greater functionality and reliability. 

Using RubyGems, you can: 
- download and install Ruby libraries easily 
- not worry about libraries A and B depending on 
  different versions of library C 
- easily remove libraries you no longer use 
- have power and control over your Ruby platform! 

WWW: http://docs.rubygems.org/
freebsd-vm# 
&lt;/pre&gt;

Let's install it.  The install requires ruby to be installed, so it installs that for us (if it's not currently installed).  I enabled RDOC and DEBUG and disabled IPV6.
(This may take a while, go grab some coffee)

&lt;pre&gt;
freebsd-vm# make install
=&gt; rubygems-1.2.0.tgz doesn't seem to exist in /usr/ports/distfiles/ruby.
=&gt; Attempting to fetch from http://rubyforge.rubyuser.de/rubygems/.
rubygems-1.2.0.tgz                            100% of  241 kB  138 kBps
===&gt;  Extracting for ruby18-gems-1.2.0_1
[...]
If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

===&gt;   Registering installation for ruby18-gems-1.2.0_1
freebsd-vm# 
&lt;/pre&gt;

Now we need to install rails.

&lt;pre&gt;
freebsd-vm# gem install rails
Successfully installed rake-0.8.1
Successfully installed activesupport-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed actionpack-2.1.0
[...]
Installing RDoc documentation for actionpack-2.1.0...
Installing RDoc documentation for actionmailer-2.1.0...
Installing RDoc documentation for activeresource-2.1.0...
freebsd-vm# 
&lt;/pre&gt;

We need to install postgresql-server.

&lt;pre&gt;
freebsd-vm# make search key=postgres | grep Path: | grep server
Path: /usr/ports/databases/aolserver-nspostgres
Path: /usr/ports/databases/erserver
Path: /usr/ports/databases/postgresql73-server
Path: /usr/ports/databases/postgresql74-server
Path: /usr/ports/databases/postgresql80-server
Path: /usr/ports/databases/postgresql81-server
Path: /usr/ports/databases/postgresql82-server
Path: /usr/ports/databases/postgresql83-server
Path: /usr/ports/finance/tinyerp-server
Path: /usr/ports/net/sipxcommserverlib
Path: /usr/ports/net-im/iserverd
freebsd-vm# 
&lt;/pre&gt;

Let's install version 8.3.  In the options that came up, I selected Build with PAM support and left the other defaults.

&lt;pre&gt;
freebsd-vm# cd databases/postgresql83-server/
freebsd-vm# make install
cd /usr/ports/databases/postgresql83-server &amp;&amp; make config;
[...]
      For more information, and contact details about the security
      status of this software, see the following webpage: 
http://www.postgresql.org/
freebsd-vm# 
&lt;/pre&gt;

We need to set postgres to run at startup.

&lt;pre&gt;
freebsd-vm# echo 'postgresql_enable="YES"' &gt;&gt; /etc/rc.conf
freebsd-vm# 
&lt;/pre&gt;

Initialize the database.

&lt;pre&gt;
freebsd-vm# /usr/local/etc/rc.d/postgresql initdb
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 40
selecting default shared_buffers/max_fsm_pages ... 28MB/179200
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

freebsd-vm# 
&lt;/pre&gt;

Start up the database.

&lt;pre&gt;
freebsd-vm# /usr/local/etc/rc.d/postgresql start
freebsd-vm#
&lt;/pre&gt;

Verify that postgres is working.

&lt;pre&gt;
freebsd-vm# createdb test -U pgsql
freebsd-vm# dropdb test -U pgsql
freebsd-vm# 
&lt;/pre&gt;

There is a postgres GEM.  Let's install it.

&lt;pre&gt;
freebsd-vm# gem install postgres
Building native extensions.  This could take a while...
Successfully installed postgres-0.7.9.2008.01.28
1 gem installed
Installing ri documentation for postgres-0.7.9.2008.01.28...
Installing RDoc documentation for postgres-0.7.9.2008.01.28...
freebsd-vm# 
&lt;/pre&gt;

Now we can create a rails application (I switched to a non-root user).

&lt;pre&gt;
freebsd-vm$ rails -d postgresql sample_rails_app
      create  
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
[...]
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
freebsd-vm$  
&lt;/pre&gt;

Setup the postgres user for your application

&lt;pre&gt;
freebsd-vm$ createuser --username pgsql
Enter name of role to add: sample_rails_app
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
freebsd-vm$ cd sample_rails_app/
freebsd-vm$ rake db:create
(in /usr/home/jasonn/sample_rails_app)
freebsd-vm$ 
&lt;/pre&gt;

Create a User scaffold

&lt;pre&gt;
freebsd-vm$ script/generate scaffold User username:string password:string homedir:string ftp_disabled:boolean
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/users
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      exists  public/stylesheets/
      create  app/views/users/index.html.erb
      create  app/views/users/show.html.erb
      create  app/views/users/new.html.erb
      create  app/views/users/edit.html.erb
      create  app/views/layouts/users.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/users_controller.rb
      create  test/functional/users_controller_test.rb
      create  app/helpers/users_helper.rb
       route  map.resources :users
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/user.rb
      create    test/unit/user_test.rb
      create    test/fixtures/users.yml
      create    db/migrate
      create    db/migrate/20080902231538_create_users.rb
freebsd-vm$ rake db:migrate
(in /usr/home/jasonn/sample_rails_app)
== 20080902231538 CreateUsers: migrating ======================================
-- create_table(:users)
NOTICE:  CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
   -&gt; 0.0645s
== 20080902231538 CreateUsers: migrated (0.0665s) =============================

freebsd-vm$ 
&lt;/pre&gt;
 
Start up the server and visit http://localhost:3000/users (you may need to substitute your IP address)

&lt;pre&gt;
freebsd-vm$ script/server
=&gt; Booting WEBrick...
=&gt; Rails 2.1.0 application started on http://0.0.0.0:3000
=&gt; Ctrl-C to shutdown server; call with --help for options
[...]
&lt;/pre&gt;

Create some users, your Rails app is up and running.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/2678614208649645686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=2678614208649645686' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2678614208649645686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2678614208649645686'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/installing-ruby-on-rails-in-freebsd.html' title='Installing Ruby on Rails in FreeBSD with Postgres'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-2401538401419904151</id><published>2008-09-01T22:41:00.003-04:00</published><updated>2008-09-01T23:00:28.640-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ports'/><category scheme='http://www.blogger.com/atom/ns#' term='cvsup'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><title type='text'>Updating the ports tree in FreeBSD</title><content type='html'>After setting up a minimal FreeBSD &lt;a href=http://jasonnoble.org/2008/09/setting-up-freebsd-vm-with-parallels.html&gt;install&lt;/a&gt;, I want to update the ports tree to the latest available.

FreeBSD provides a program to do this.  It's called cvsup (cvs update).  To find the program, I search the ports tree.

&lt;pre&gt;
freebsd# cd /usr/ports
freebsd# make search key=cvsup | grep Path:
Path: /usr/ports/chinese/auto-tw-l10n
Path: /usr/ports/lang/ezm3
Path: /usr/ports/misc/instant-server
Path: /usr/ports/net/csup
Path: /usr/ports/net/cvsup
Path: /usr/ports/net/cvsup-mirror
Path: /usr/ports/net/cvsup-without-gui
Path: /usr/ports/net/cvsupchk
Path: /usr/ports/ports-mgmt/port-authoring-tools
Path: /usr/ports/ports-mgmt/port-maintenance-tools
Path: /usr/ports/sysutils/desktopbsd-tools
Path: /usr/ports/sysutils/fastest_cvsup
Path: /usr/ports/sysutils/maint
freebsd# 
&lt;/pre&gt;

I want the cvsup without the gui, so I change into that directory and install it.

&lt;pre&gt;
freebsd# cd net/cvsup-without-gui/
freebsd# sudo make install
===&gt;  Extracting for cvsup-without-gui-16.1h_4
=&gt; MD5 Checksum OK for cvsup-snap-16.1h.tar.gz.
=&gt; SHA256 Checksum OK for cvsup-snap-16.1h.tar.gz.
===&gt;  Patching for cvsup-without-gui-16.1h_4
===&gt;  Applying FreeBSD patches for cvsup-without-gui-16.1h_4
[...]
===&gt;   Registering installation for cvsup-without-gui-16.1h_4
===&gt; SECURITY REPORT: 
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/cvsupd
/usr/local/bin/cvsup
/usr/local/bin/cvpasswd

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage: 
http://www.cvsup.org/
freebsd# 
&lt;/pre&gt;

I next need a config file to make cvsup update the ports tree.

&lt;pre&gt;
#vi /root/ports-supfile
# IMPORTANT: Change the next line to use one of the CVSup mirror sites
# listed at http://www.freebsd.org/doc/handbook/mirrors.html.
*default host=cvsup5.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix

# If you seem to be limited by CPU rather than network or disk bandwidth, try
# commenting out the following line.  (Normally, today's CPUs are fast enough
# that you want to run compression.)
*default compress

## Ports Collection.
#
# The easiest way to get the ports tree is to use the "ports-all"
# mega-collection.  It includes all of the individual "ports-*"
# collections,
ports-all
&lt;/pre&gt;

Now we run rehash to rescan our PATH variable for new commands, then run cvsup to update our ports tree.

&lt;pre&gt;
freebsd# rehash
freebsd# cvsup /root/ports-supfile
Connected to cvsup5.us.FreeBSD.org
Updating collection ports-all/cvs
[...]
Finished successfully
freebsd# 
&lt;/pre&gt;

Now our ports tree is up to date.  If you want to see what ports you've installed that have security updates available, run "/usr/local/sbin/portaudit".  It will list any ports that need updating.  If you get command not found, cd to /usr/ports/ports-mgmt/portaudit and do a "sudo make install".</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/2401538401419904151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=2401538401419904151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2401538401419904151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2401538401419904151'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/updating-ports-tree-in-freebsd.html' title='Updating the ports tree in FreeBSD'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-643492407231223104</id><published>2008-09-01T18:43:00.012-04:00</published><updated>2008-09-01T22:17:25.094-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parallels'/><category scheme='http://www.blogger.com/atom/ns#' term='OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='10.5'/><category scheme='http://www.blogger.com/atom/ns#' term='Leopard'/><title type='text'>Setting up a FreeBSD VM with Parallels under OS X Leopard</title><content type='html'>To read this post with screen shots, use one of the following links:
&lt;ul&gt;
&lt;li&gt;&lt;A HREF=/long_posts/2008/09/setting-up-freebsd-vm-with-parallels.html&gt;HTML&lt;/A&gt;&lt;/li&gt;
&lt;li&gt;&lt;A HREF=/long_posts/2008/09/setting-up-freebsd-vm-with-parallels.pdf&gt;PDF&lt;/A&gt;&lt;/li&gt;
&lt;li&gt;&lt;A HREF=/long_posts/2008/09/setting-up-freebsd-vm-with-parallels.zip&gt;PDF Zip&lt;/A&gt;&lt;/li&gt;
&lt;/ul&gt;

My goal is to have a FreeBSD 7.0 based virtual machine running under Parallels on my OS X 10.5 Leopard iMac.&lt;P&gt;

Open Parallels and select File -&gt; New&lt;P&gt;

&lt;img src=/images/freebsd_vm_install/freebsd_vm_1.png&gt;&lt;P&gt;

As my server is just for local development, I didn't give it a bunch of RAM.  You may change this if you have more available RAM.  I selected 256MB.  Click Next.&lt;P&gt;


This is a new VM, so I want to create a new hard disk image.  Click Next.&lt;P&gt;


Again, this is only a development box, so I used only 5GB for a hard drive.  I would leave it as Expanding unless you want to pre-allocate the space on your mac.  Click Next.&lt;P&gt;


The next window gives networking options.  If you need other machines on your local network to access this machine, select Bridged Ethernet, otherwise use Shared Networking.  Click Next.&lt;P&gt;


You can name the virtual machine whatever you want.  You can uncheck the Create icon on your Desktop if you want.  I would not share this virtual machine with other users.  Click Next.&lt;P&gt;


This next screen is a user preference.  Do you want your mac to give preference to OS X applications or the FreeBSD vm's applications?  On a desktop, I think it's fine to leave it with the recommended option.  Click Next.&lt;P&gt;


You can choose how to install the OS.  If you have a physical disk, choose Real CD/DVD and insert it into your Mac's disk drive.  I downloaded the FreeBSD ISOs so I chose ISO image (use disc1).  Click Finish.&lt;P&gt;


Your vm should start booting.  &lt;P&gt;


Once the installation starts, you need to select your country.   Use the arrow keys (up and down) to select your contry, then hit Enter.&lt;P&gt;


Arrow down to Custom and hit Enter&lt;P&gt;


Arrow down to Partition and hit Enter to go into fdisk.&lt;P&gt;


Hit F to dedicate the entire (virtual) disk to FreeBSD.  When the prompt comes up, hit Enter.&lt;P&gt;


Hit Q to finish.&lt;P&gt;

Leave the BootMgr default and hit Enter.&lt;P&gt;


Arrow down to Label and hit Enter.&lt;P&gt;


You will get a screen about creating BSD partitions. &lt;P&gt;

Hit C to create a partition.  Type in 256M for the size.  Hit Enter.  &lt;P&gt;


In the partition type window, arrow down until Swap is highlighted.  Hit Enter.&lt;P&gt;


Hit C to create a partition.  Leave the default size entered and hit Enter.  &lt;P&gt;


Leave FS (A file system) highlighted and hit Enter.&lt;P&gt;


For the mount point, type in / and hit Enter.&lt;P&gt;


Your Disklabel screen should now look like the following (assuming a 5GB disk drive)&lt;P&gt;


Hit Q to finish.&lt;P&gt;

Arrow down to Distributions and hit Enter.&lt;P&gt;


Arrow down until Minimal is highlighted.  Hit space to select this option.&lt;P&gt;


Arrow down to Custom and hit space to select it.&lt;P&gt;


In this menu you can select the packages you want installed.  For a base level system, I install base, kernels, man and catman.  I also install the ports option so I can install additional software from the FreeBSD ports collection.  Arrow to each option you want to install and hit &lt;SPACE&gt; to select/deselect it.  Hit &lt;TAB&gt; to OK and hit Enter to continue.&lt;P&gt;

Arrow up to Exit and hit Enter to continue.&lt;P&gt;


(Optional) If you need to change the installation media (default is CD/DVD), highlight Media and hit Enter.&lt;P&gt;


(Optional) Select the installation media you would like to use and hit Enter to continue.&lt;P&gt;


Arrow down to Commit and hit Enter.&lt;P&gt;


At the Last Chance! screen hit Enter to start the installation.&lt;P&gt;

Go grab a coffee and take a break.&lt;P&gt;

After you get back, you should see a window asking if you want to further configure the box.  Hit &lt;TAB&gt; to highlight Yes and hit Enter.&lt;P&gt;


You probably want to set a root password (blank by default).  Arrow down to Root Password and hit Enter.&lt;P&gt;


Type in a good password when prompted.  It will ask you to retype the password to make sure you didn't misstype the first time.&lt;P&gt;


(Optional) You may want to make a non-root user.  Arrow down to User Management and hit Enter.&lt;P&gt;


(Optional) Arrow down to User and hit Enter.&lt;P&gt;


Fill out the fields for your user (&lt;TAB&gt; between fields).  Highlight Ok and hit Enter to continue.&lt;P&gt;


The other options are mostly self explanatory.  You probably want to set your Time Zone.&lt;P&gt;

You also need to setup your networking.  Arrow down to Networking and hit Enter.&lt;P&gt;


Arrow down to Interfaces and hit Enter.&lt;P&gt;


Select the Novell NE1000/2000 highlighted and hit Enter.&lt;P&gt;


Do you need IPv6?  Probably not, leave No highlighted and hit Enter.&lt;P&gt;


You should enable DHCP, as that is how Parallels gives it an IP address.  Hit &lt;TAB&gt; to highlight Yes and hit Enter.&lt;P&gt;


You should give your vm a hostname.  The IPv4 Gateway and IP info should be auto filled in.&lt;P&gt;


Hit &lt;TAB&gt; until Ok is highlighted and hit Enter to continue.&lt;P&gt;

You probably want SSH access, so hit arrow down to highlight ssh and hit Enter.&lt;P&gt;


You may want to enable the ntpdate service.  It will keep your system clock synced.  Highlight Ntpdate and hit Enter.&lt;P&gt;


Select a server to synchronize with.  Pick one that is "close" to you.  Hit Enter to continue.&lt;P&gt;


When you're done selecting services, hit &lt;TAB&gt; until Ok is selected and hit Enter.&lt;P&gt;


Arrow up to Exit and hit Enter.&lt;P&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/643492407231223104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=643492407231223104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/643492407231223104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/643492407231223104'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/09/setting-up-freebsd-vm-with-parallels.html' title='Setting up a FreeBSD VM with Parallels under OS X Leopard'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-5846743945363398686</id><published>2008-08-21T10:49:00.008-04:00</published><updated>2008-08-21T11:25:25.275-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mount point'/><category scheme='http://www.blogger.com/atom/ns#' term='netapp'/><category scheme='http://www.blogger.com/atom/ns#' term='nfs'/><category scheme='http://www.blogger.com/atom/ns#' term='showmount'/><category scheme='http://www.blogger.com/atom/ns#' term='filer'/><title type='text'>Show mounted filesystems on a Netapp</title><content type='html'>We're working on moving from an old Netapp to a new Netapp.  Before doing so, we need to make sure that no systems have any mount points on the old filer still mounted.&lt;P&gt;

On a regular/unix nfs server, you would login to the box and run "showmount -a" which queries the mount daemon.  The netapp systems don't offer the showmount command though.&lt;P&gt;

I found a mailing list &lt;a href=http://toasters.mathworks.com/toasters/9199.html&gt;article&lt;/a&gt; that explained you can run "showmount -a XYZ" where XYZ is the hostname/ip of your netapp filer.&lt;P&gt;

&lt;pre&gt;
roadrunner:~ # showmount -a 172.16.2.6
All mount points on 172.16.2.6:
10.1.112.17:/vol/root
172.16.13.16:/vol/space/offsite.backup
172.16.13.18:/vol/space/offsite.backup
172.16.13.5:/vol/space/db.preprod
172.16.13.5:/vol/space/offsite.backup
172.16.13.7:/vol/space/offsite.backup
172.16.23.1:/vol/space/endeca.preprod
172.16.23.6:/vol/space/db.preprod
172.16.23.6:/vol/space/offsite.backup
172.16.3.6:/vol/root
mailhost:/vol/space/imagemgr
roadrunner:~ # 
&lt;/pre&gt;

Now I know what hosts I need to check before deprovisioning this Netapp.&lt;P&gt;

Update:  From the &lt;a href=http://toasters.mathworks.com/toasters/9199.html&gt;article&lt;/a&gt;, I missed the caveat.  NFS is stateless, so some unix hosts could still have the system mounted, but not actively use the mount.&lt;P&gt;

As suggested, I turned the nfs.per_client_stats.enable bit on, and now I'll just wait and see who is actively using the Netapp.&lt;P&gt;

&lt;pre&gt;
netapp&gt; options nfs
[...]
nfs.netgroup.strict          off        
nfs.per_client_stats.enable  off        
nfs.require_valid_mapped_uid off        
[...]
netapp&gt; options nfs.per_client_stats.enable on
netapp&gt; nfsstat -l
172.16.2.2    &lt;hostname unknown&gt;              NFSOPS =          6 ( 0%)
172.16.3.2    mailhost                        NFSOPS =          8 ( 0%)
netapp&gt; 
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/5846743945363398686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=5846743945363398686' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/5846743945363398686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/5846743945363398686'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/08/show-mounted-filesystems-on-netapp.html' title='Show mounted filesystems on a Netapp'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-2629512146758025020</id><published>2008-08-19T10:02:00.003-04:00</published><updated>2008-09-01T23:07:43.729-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dns'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>DNS Resolver</title><content type='html'>I had a list of domains that needed their MX records updated.  I first wanted to make sure that our DNS servers were authoritative for those zones.  

I used Perl and the Net::DNS CPAN module to figure out the NS records for each domain.

&lt;pre&gt;
#!/usr/bin/perl

use Net::DNS;

my $resolver = Net::DNS::Resolver-&gt;new;
my $query = "";
my $domain = "";

open(FILE, "&amp;lt;/tmp/domains.txt");
while(&lt;FILE&gt;) {
  chomp;
  $domain = $_;
  $query = $resolver-&gt;query($domain, "NS");
  print $domain;
  if($query) {
    foreach my $rr ($query-&gt;answer) {
      next unless $rr-&gt;type eq "NS";
      print ",", $rr-&gt;nsdname;
    }
    print "\n";
  } else {
    print ",DOES NOT RESOLVE\n";
  }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/2629512146758025020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=2629512146758025020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2629512146758025020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/2629512146758025020'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/08/dns-resolver.html' title='DNS Resolver'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2383541800224195596.post-4105025115305572836</id><published>2008-08-13T12:03:00.006-04:00</published><updated>2008-08-15T16:21:48.982-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ucfirst'/><category scheme='http://www.blogger.com/atom/ns#' term='tcl'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Tcl version of ucfirst</title><content type='html'>The load balancers we use at work have a TCL command line interface. A co-worker needed a TCL function written that would take a string as input and return the string transformed so that the first letter was upper case and the rest were lower case. There is a built in string function called toupper but that capitalizes the full string instead of only the first.&lt;p&gt;

My solution (shown below) is to split the string into two strings, toupper the first string and tolower the second, then append them together. The result is the equivalent of Perl's ucfirst implemented in TCL.&lt;P&gt;

&lt;pre&gt;
proc ucfirst str {
 set a [ string toupper [ string range $str 0 0 ]]
 append a [ string tolower [ string range $str 1 end ]]
 return $a
}
&lt;/pre&gt;

You can use this from the command line by using tclsh. Below is what running this code will look like (the % is the tclsh prompt).&lt;P&gt;

&lt;pre&gt;
[jasonn@jnoble-vm ~]$ tclsh
% proc ucfirst str {
 set a [ string toupper [ string range $str 0 0 ]]
 append a [ string tolower [ string range $str 1 end ]]
 return $a
}
%
% set mystring "firetruck"
firetruck
% set t [ ucfirst $mystring ]
Firetruck
% set mystring "cop car"
cop car
% set t [ ucfirst $mystring ]
Cop car
% exit
[jasonn@jnoble-vm ~]$
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/4105025115305572836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2383541800224195596&amp;postID=4105025115305572836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4105025115305572836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2383541800224195596/posts/default/4105025115305572836'/><link rel='alternate' type='text/html' href='http://jasonnoble.org/2008/08/tcl-version-of-ucfirst.html' title='Tcl version of ucfirst'/><author><name>Jason Noble</name><uri>http://www.blogger.com/profile/12779892190227704860</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>