Wednesday 26 March 2014

Exploring DotCMS Cont.

Looks like a very Robust CMS system that allows all kinds of content.
Also integrates many canvases for editing content either by typing HTML or using WUSIWUG.
The tool is very polished and the test site that comes with it is a very cool static site that is enterprise grade.

Though i didn't test how would it be able to handle lots of hits for content queries and didn't do comprehensive site creation with it.

Will continue to post more about it . . .

Thursday 20 March 2014

Exploring DotCMS

The dotcms tool is proving to be a great content management system for free.
It has all the bells and whistles out of the box.
just finished its installation and now started playing with it.
Proves to be rather solid and very well organized.

Will post more as it goes.
http://dotcms.com/

Sunday 2 March 2014

Generic multi instance startup script

Currently working on creating a generic multi instance start up script for TC server  (tomcat).
Features should include:
1- startall
2- stopall
3- start a set of TCs serving same part of the business
4- stop a set of TCs serving same part of the business
5- start 1 instance
6- stop 1 instance
7- print status of all TC instances

Once done will post the script here.
The script used a config file, will post it also :)

#set -x

if [ -z ${1} ]
then
        echo "missing property file"
        exit 1
fi
####
## need to initalize the APPS Associative array here.
typeset -A APPS
source ${1}

###
# Display the apps :)
#echo ${!APPS[@]}



####
## Setting action menu
actions="start stop status stopAll startAllDefault start_selective stop_selective"
if [ "$2" != "" ]; then
  action=$2
else
  echo "Please select an action:"
  select action in ${actions}; do
    case ${REPLY} in
      1|2|3|4|5|6|7) echo "Selection: ${action}"; break;;
      *) echo "Invalid Selection. Exiting."; exit 1;;
    esac
  done
fi
 
#set -x

if [ -z ${1} ]
then
        echo "missing property file"
        exit 1
fi
####
## need to initalize the APPS Associative array here.
typeset -A APPS
source ${1}

###
# Display the apps :)
#echo ${!APPS[@]}



####
## Setting action menu
actions="start stop status stopAll startAllDefault start_selective stop_selective"
if [ "$2" != "" ]; then
  action=$2
else
  echo "Please select an action:"
  select action in ${actions}; do
    case ${REPLY} in
      1|2|3|4|5|6|7) echo "Selection: ${action}"; break;;
      *) echo "Invalid Selection. Exiting."; exit 1;;
    esac
  done
fi
 
start|stop|status)
                for instance in `echo ${APP_SERVER_RUN_DEFAULT}|tr "," " "`
                do
                        HOST=`echo ${instance} |cut -d"_" -f1`
                        PORT=`echo ${instance} |cut -d"_" -f2`
                        echo ""
                        echo "Working on ${HOST}"
                        read -n1 -p "Do you want to preform the action: ${action} on ${instance} ?" reply
                        if [ "${reply}" = "y" ]
                        then
                                echo ""
                                ssh -q ${TARGET_USER_NAME}@${HOST} ${TARGET_TCS_INST_HOME}/${instance}/bin/tcruntime-ctl.sh ${action}
                        else
                                echo ""
                                echo "no action on ${instance}"
                        fi
                done
                echo "All Done"
        ;;

        start_selective)


                select APPkey in ${!APPS[@]}
                do
                        echo "${APPkey}: ${APPS[${APPkey}]}";
                        action=start
                        for instance in `echo ${APP_SERVER_RUN_DEFAULT}|tr "," " "`
                        do
                                HOST=`echo ${instance} |cut -d"_" -f1`
                                PORT=`echo ${instance} |cut -d"_" -f2`
                                FOUND=`echo ${APPS[${APPkey}]} |grep ${PORT} |wc -l`
                                #echo $FOUND
                                if [ ${FOUND} = "0" ]
                                then
                                        echo "skipping"
                                else
                                        echo ""
                                        echo "Working on ${HOST}"
read -n1 -p "Do you want to preform the action: ${action} on ${instance} ?" reply
                                        if [ "${reply}" = "y" ]
                                        then
                                                echo ""
                                                ssh -q ${TARGET_USER_NAME}@${HOST} ${TARGET_TCS_INST_HOME}/${instance}/bin/tcruntime-ctl.sh ${action}
                                        else
                                                echo ""
                                                echo "no action on ${instance}"
                                        fi
                                fi
                        done

                        #break the select loop
                        break
                done
        ;;

        stop_selective)

                select APPkey in ${!APPS[@]}
                do
                        echo "${APPkey}: ${APPS[${APPkey}]}";
                        action=stop
                        for instance in `echo ${APP_SERVER_RUN_DEFAULT}|tr "," " "`
                        do
                                HOST=`echo ${instance} |cut -d"_" -f1`
                                PORT=`echo ${instance} |cut -d"_" -f2`
                                FOUND=`echo ${APPS[${APPkey}]} |grep ${PORT} |wc -l`
                                #echo $FOUND
                                if [ ${FOUND} = "0" ]
                                then
                                        echo "skipping"
                                else
                                        echo ""
                                        echo "Working on ${HOST}"
                                        read -n1 -p "Do you want to preform the action: ${action} on ${instance} ?" reply
                                        if [ "${reply}" = "y" ]
                                        then
echo ""
                                                ssh -q ${TARGET_USER_NAME}@${HOST} ${TARGET_TCS_INST_HOME}/${instance}/bin/tcruntime-ctl.sh ${action}
                                                ssh -q ${TARGET_USER_NAME}@${HOST} rm -rf ${TARGET_TCS_INST_HOME}/${instance}/work/*
                                                ssh -q ${TARGET_USER_NAME}@${HOST} rm -rf ${TARGET_TCS_INST_HOME}/${instance}/temp/*
                                                ssh -q ${TARGET_USER_NAME}@${HOST} "find ${TARGET_TCS_INST_HOME}/${instance}/webapps/* -type d|grep -v ROOT|xargs rm -rf"
                                        else
                                                echo ""
                                                echo "no action on ${instance}"
                                        fi
                                fi
                        done

                        #break the select loop
                        break
                done

        ;;


esac