Feeds:
Posts
Comments

Archive for the ‘BASH’ Category

The oracle start/stop script I’ve found on the net (written for REHL, I believe), didn’t work for me. Thus, I wrote a wee script that works for my 11g install (on Debian).

#! /usr/bin/env bash                                                                     

function stop_db()
{
    sqlplus /nolog <<EOF                                                         
connect /as sysdba                                                               
shutdown                                                                         
EOF                                                                              
    lsnrctl stop
}

function start_db()
{
    sqlplus /nolog <<EOF                                                         
connect /as sysdba                                                               
startup                                                                          
EOF                                                                              
    lsnrctl start
}

case "$1" in
    start)
        start_db
        ;;
    stop)
        stop_db
        ;;
    *)
        echo "Usage:" `basename $0` ""
        ;;
esac

exit 0

As you can see, its far simpler than the more “official” scripts, but it does exactly what I want it to, so I’m happy 🙂

Read Full Post »

It’s impossible to get that title right.

What I thought of this, whenever listing program code on your web page, it’s normally done either in code or pre elements. That’s fine, but they get monotyped and display their indentation and so on just nicely. Now, what if they were colourised just like in the programming editor? Wouldn’t that make the code example all that more interesting.

I thought of making a wee web service that just retuns the colourised code markup, so it could easily be called from whatever application and displayed in an instant. It could be real easy low level stuff, such as making a BASH cgi script, containing something like:

  for el in $purple_list; do 
    sed 's/$el/\<span class\=\"purple\">$el</span>\/g'\
      < $tmp2; > $tmp
    cp $tmp $tmp2
  done

You need the two tmp variables because of BASH’s redirect policy (first clearing the target destination etc).

Then again, the colours might mess up the page overall web design…

Read Full Post »