Archive for August, 2007

Oracle sysV init script on the fly

Every time I need an Oracle init script file, it’s a terrible pain! No way to use a simple start/stop/status (with nagios check)…

Today I write “on-the-fly” this very simple script to run Oracle Database on RedHat Cluster Suite without nagios plugin.

#!/bin/sh
 
#chkconfig: 2345 80 05
#description: Oracle DB
 
ORA_HOME=/opt/oracle/product/9.2.0
ORA_OWNER=oracle
LOG="/dev/null"
 
prog="Oracle"
lockfile="/var/lock/subsys/oracle"
 
# Source function library.
if [ -r "/etc/rc.d/init.d/functions" ]; then
	. /etc/rc.d/init.d/functions
fi
 
# Oralce configurations
if [ -r "/etc/sysconfig/oracle.conf" ]; then
        . /etc/sysconfig/oracle.conf
fi
 
export ORA_HOME
export ORA_OWNER
export LOG
export prog
export lockfile
 
if [ ! -f $ORA_HOME/bin/dbstart ]
then
  echo "Oracle startup: cannot start"
  exit
fi
 
RETVAL=0
 
start() {
     if [ -f ${lockfile} ]; then
         echo "Oracle already running"
         exit 1
     fi
 
     echo -n "Starting $prog: "
     runuser - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
     RETVAL_DB=$?
     runuser - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start > $LOG"
     RETVAL_LSN=$?
     if (($RETVAL_DB == "0")) && (($RETVAL_LSN == "0")) ; then
         RETVAL="0"
	 touch ${lockfile}
	 echo_success
     else
         RETVAL="1"
	 echo_failure
     fi
     return $RETVAL
}
 
stop() {
     if [ ! -f ${lockfile} ]; then
         echo "Oracle already stopped"
         exit 0
     fi
     echo -n $"Stopping $prog: "
     runuser - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
     RETVAL_DB=$?
     runuser - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop > $LOG"
     RETVAL_LSN=$?
     if (($RETVAL_DB == "0")) && (($RETVAL_LSN == "0")) ; then
         RETVAL="0"
	 rm -f ${lockfile}
	 echo_success
     else
         RETVAL="1"
	 echo_failure
     fi
     return $RETVAL
}
 
status() {
     RETVAL=1
     pid=`pgrep -u $ORA_OWNER`
     if [ -n "$pid" ]; then
           RETVAL=0
           echo -n "$prog is running..."
           echo_success
     else
           echo -n "$prog is not running."
           echo_failure
     fi
     return $RETVAL
}
 
case "$1" in
  "start")
       start
       ;;
  "stop")
       stop
       ;;
  "restart")
       start
       stop
       ;;
  "status")
       status
       ;;
  *)
       echo $"Usage: $prog {start|stop|restart|status}"
       exit 1
 
esac
echo
exit $RETVAL

Improve your GIT experience

I love git. It’s simple, fast, and it’s the first “new generation” versioning system.

I’ve used git for 3/4 months, and now I won’t be able to use anything else (like cvs or svn …)

Here you can see Linus Torvalds (the author of git) during a presentation about git:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Why “Ruby on Rails” will win vs. Seam…

Ruby on Rails (and C., like Turbo Gear and so on…) will  win to java technology because the concept of  “keep it simple” is too far from the minds of java developers.

Today I read this post on TheServerSide, and I’m getting depressed… every time someone try to follow a good idea (like Seam with Ruby on Rail), an other one wants to improve this idea and makes new things… and this is the reason about the fragmentation of java thecnology (too much framework, too much “infrastructure”, too much little “business”).

Now, if you want to start new projects in Java, you can choose between thousands of frameworks, but if you’ve chosen “Seam”,  you have to choose also the persistence layer of your applications…

Two projects based on Seam may be incompatible from each other… Really good…

LOL

LOL :-D

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Amadeus

Every time is a pleasure! :-)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

-->