Tuesday, November 27, 2007

MySQL Dump shell script


I found this script over at http://crazytoon.com/ just thought I would put it on my post-it site to remember.

#!/bin/bash
db=$1
if [ “$db” = “” ]; then
echo “Usage: $0 db_name”
exit 1
fi
mkdir $$
cd $$
clear
for table in `mysql $db -e ’show tables’ | egrep -v ‘Tables_in_’ `; do
echo “Dumping $table”
mysqldump –opt $db $table > $table.sql
done
if [ “$table” = “” ]; then
echo “No tables found in db: $db”
fi

Wednesday, November 21, 2007

Working with Dell RAC

Well again I’m having issues with something. This time is the awesome easy to use greatly improved, best in class super administration toll RAC (Remote access console)from Dell. Because of the way that I’m located in the world, and my vpn connection to the datacenter I can’t get the rac browser plugin to work but there is supposed to be a ssh connection available also.

Got ssh working (enabled by default) just ssh root@server_ip and used the same password as the web client.

Now we need to enable the serial console features:

    $ racadm config -g cfgSerial -o cfgSerialConsoleEnable 1
    $ racadm config -g cfgSerial -o cfgSerialTelnetEnable 1
    $ racadm getconfig -g cfgSerial

    cfgSerialBaudRate=57600
    cfgSerialConsoleEnable=1
    cfgSerialConsoleQuitKey=^\
    cfgSerialConsoleIdleTimeout=300
    cfgSerialConsoleNoAuth=0
    cfgSerialConsoleCommand=
    cfgSerialHistorySize=8192
    cfgSerialCom2RedirEnable=1
    cfgSerialTelnetEnable=1
    cfgSerialSshEnable=1

Modify the Grand Unified Bootloader (GRUB) configuration.
In the Linux configuration file /etc/grub.conf, add the following
two lines in the general settings section of the file:
serial -–unit=0 -–speed=57600
terminal -–timeout=10 serial
Next, append the kernel and console=ttyS0,57600 options
to the kernel line. For example:
kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/
console=ttyS0,57600
If a splashimage directive such as splashimage=(hd0,2)/
grub/splash.xpm.gz appears, comment it out.

Enable login to the console after boot. In the Linux configurationfile /etc/inittab, add a line to configure a getty on the
COM1 serial port as follows:
co:2345:respawn:/sbin/agetty -h -L 57600 ttyS0
vt100

Grant permission to initiate the session. In the Linux
configuration file /etc/securetty, add ttyS0 to the list of
supported ports.

Monday, November 19, 2007

Working with Linux LVM

Growing your lvm partition.

  • Find free space:
  • lvm vgs (VFree is amount of free space)
  • Find the the logical volum:
  • lvdisplay (LV Name is what you want)
  • Extend the drive (Add 50GB to current size) : 
  • lvextend –size +50G /dev/drive
  • unmount the drive (If drive is busy use lsof | grep /mountpoint to find the process that is using the mountpoint)
  • e2fsck -f /dev/drive
  • resize2fs /dev/drivemount
  • done

Its best if the drive is umounted before the lvextend command runs. (I have never had issues with this but you never know. ) 

Thursday, November 8, 2007

hobo 0.64 with rails



ok I know I’m newbo and this is lame BUT here are the steps to get hobo installed and running.There are NO documentation except blogs and new groups for the latests version so here goes…Install latest rails and hobo gems

$ gem install rails –source http://gems.rubyonrails.org$ gem install hobo 

Now get the rails version (its going to be rails 1.99.seomthing) and set the env variable:

$ gem list rails$ export RAILS_GEM_VERSION=1.99.0.8178 
$ hobo myapp
$ cd myapp
$ script/plugin install svn://errtheblog.com/svn/plugins/will_paginate

update the myapp/config/database.yml with the correct database info and your are good-to-go.This is mine:

    development:  adapter: mysql  encoding: utf8  database: myapp_development  username: hobo  password: hobo_password  host: 10.0.0.200 

we also need to create the users table and admin user.

$ ./script/generate hobo_migration create_initial_tables$ g (for [g]enerate migration, don’t migrate yet.)

Now open the migration file db/migrate/001_creat_initial_tables and add the following after the create table end:

def self.up    
create_table :users do |t|      
t.string   :crypted_password, :limit => 40      
t.string   :salt, :limit => 40      
t.string   :remember_token      
t.datetime :remember_token_expires_at      
t.string   :username      
t.datetime :created_at      
t.datetime :updated_at    
end   

# create the admin user now because we can’t do it    
# through the web UI as it would fail validation    
admin = User.new    
admin.crypted_password = ‘ea87f9851d923a9a287631dd082799b83c0fa473′    
admin.salt = ‘7d8b386a7dfdcd0f268794038104791112cd4acd’    
admin.username = ‘admin’    
admin.save_without_validation  
end 

This will create a user ‘admin’ with password => password.
Now start the server

$ ./script/server

go to http://localhost:3000DONE!