Thursday, April 7, 2011

JIRA instance restarter

Just a simple script I use to watch for JIRA process, in case if it dies the script would restart it automatically.  This can be used for whatever process.  Note: it's using ps awwx under Solaris.

#!/bin/sh


jira=$1

pid=`/usr/ucb/ps awwx | grep java | grep "$jira"  | awk {'print $1'}`

if [ "$pid" = "" ]
then
    pid=0
fi
if [ $pid -gt 1 ]

then
    echo $jira" - JIRA is running fine"
else
    echo $jira" - JIRA is not running, trying to restart... "
    echo $jira"bin/restart.sh"
    $jira"bin/restart.sh"
fi


----------------------------------------------------------------
few more JIRA house keeping daily scripts:


## lock-cleanup.sh

#!/bin/sh
JIRA_HOME=/opt/global/jira
if [ -f $JIRA_HOME/index/comments/write.lock ];
then
    rm $JIRA_HOME/index/comments/write.lock
fi
if [ -f $JIRA_HOME/index/issues/write.lock ];
then
    rm $JIRA_HOME/index/issues/write.lock
fi


----------------------------------------------------------------
## backup-cleanup.sh 
#!/bin/sh
JIRA_HOME=/opt/global/jira
DAYS=30
find $JIRA_HOME/backup/ -name "*.zip" -ctime +$DAYS -exec rm {} \;

Friday, April 1, 2011

concrete5 add-ons install in FreeBSD

concrete5.org provides lots cool add-ons that can be installed by GUI in your concrete5 site.  The add-on is a archive zip file where it needs to be unzipped to your concrete5 web directory on the server.  If you try to install it by GUI with one click and your backend is running on FreeBSD, you going to see an install failed message without further details.  The root cause is that concrete5 hardcoded the path of unzip under /usr/bin/unzip

fix:
install unzip from FreeBSD ports, it will be located in /usr/loca/bin/unzip
cd /usr/ports/archivers/unzip
make ; make install ; make clean

make a symbolic link to it:
cd /usr/bin/
ln -s /usr/local/bin/unzip unzip

now you are done, enjoy one click install!