Uncategorized
17
Apr 10
Simple Ruby hearthbeat script with SMTP notifications
I like this script from “Deploying Rails Applications” by the “The Pragmatic Programmers” series because of its simplicity.
I’m gonna use it in one high-available project to sleep better at night.
15
Mar 10
How to fetch .property file content in bash script
Recently I had a task – implementation of automated deployment procedure to dev/stagin environment.
1) Update server’s source code to the latest version available
2) Create/recreate DB(if necessary) with certain db access parameters.
3) Implement all the latest SQL delta schema updates(via LiquiBase).
My main idea was to reduce duplicity in config management as much as possible.
So I decided to store all db config data in one property file.
database.port = 3306
database.name = fooproject_devel
database.username = foo_username
database.password = foo_password
This is how I pass parameters from property file to my custom bash script:
<project name=“Foo” default=“build” basedir=“.”>
<property file=“build.properties”/>
<target name=“recreate-db”>
<exec executable=“expect” dir=“${basedir}” failonerror=“on”>
<arg line =“recreate-db.sh” />
<arg line =“${database.username}” />
<arg line =“${database.password}” />
<arg line =“${database.name}” />
</exec>
</target>
</project>
#!/usr/bin/expect
set username [lindex $argv 0]
set password [lindex $argv 1]
set database [lindex $argv 2]
That’s it.

