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 {} \;
Thursday, April 7, 2011
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!
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!
Tuesday, March 22, 2011
converting decimals to binary & hex
Trying to keep brain from getting rusty... coded some simple functions in C that takes a decimal and spits out binary and hex. Thought I might share it, enjoy!
#include
#include
void dec2bin(int dec);
void dec2hex(int dec);
int main(char *argv[])
{
int i,j,num,tmp;
scanf("%d",&num);
printf("dec: %d\n",num);
printf("bin: ");
dec2bin(num);
printf("\nhex: ");
dec2hex(num);
}
void dec2bin(int dec)
{
if (dec>0)
{
dec2bin(dec>>1);
if (dec&1>=1)
printf("1");
else
printf("0");
}
}
void dec2hex(int dec)
{
if (dec>0)
{
if (dec<10)
printf("%d",dec);
else if (dec>15)
{
dec2hex(dec/16);
dec2hex(dec%16);
}
else
printf("%c",dec-10+'A');
}
else
printf("0");
}
Monday, March 7, 2011
using ipod shuffle under linux
I've been using gtkpod with my ipod shuffle. A while ago, not sure what I have done when loading new songs into it, seems everything is corrupted, in gtkpod and hipo both shows the old songs, but when I play it there were only a few new songs available on the device and old ones were not in there. Tried both gtkpod and hipo to delete the songs to start from fresh but had no luck. At the end, command line tools does th trick, install gnupod-tools
gnupod_INIT -m /media/IPOD
gnucheck_--fixit -m /media/IPOD
gnupod_INIT -m /media/IPOD
gnucheck_--fixit -m /media/IPOD
Friday, December 10, 2010
Ubuntu netbook SD card reader issue in Acer AspireOne
Recently I got a new netbook Acer AspireOne D255
Installed Ubuntu 10.10, unfortunately the new clutter windows manager - mutter was a big disappointment, it has an obvious performance issue when comparing without mutter even on a slower atom processor! this made me go back to 10.04.
The new model seem to be using a different brand of SD card reader which has no driver support from linux...
lsusb shows the following:
After google around, several of suggested grub and modprobe config changes doesn't work at all, finally found the driver has just been recently added to the kernel from version 2.6.36, which 10.04 came with 2.6.32 obviously wouldn't work.
The new kernel isn't available in the standard repository, but to add it, just follow these simple steps:
Reference:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/633852
Installed Ubuntu 10.10, unfortunately the new clutter windows manager - mutter was a big disappointment, it has an obvious performance issue when comparing without mutter even on a slower atom processor! this made me go back to 10.04.
The new model seem to be using a different brand of SD card reader which has no driver support from linux...
lsusb shows the following:
ENE Flash
UB6250
606569746801
After google around, several of suggested grub and modprobe config changes doesn't work at all, finally found the driver has just been recently added to the kernel from version 2.6.36, which 10.04 came with 2.6.32 obviously wouldn't work.
The new kernel isn't available in the standard repository, but to add it, just follow these simple steps:
sudo add-apt-repository ppa:kernel-ppa/ppa
sudo apt-get update
apt-get install linux-image-2.6.37-8-generic
reboot with the new 2.6.37-8 kernel then you'll see the SD card!
Reference:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/633852
Monday, July 19, 2010
capture images from avi using ffmpeg
this script would use ffmpeg to split a video into series of images on the second provided.
#!/bin/bash
for i in `seq -w 1 1 100`
for i in `seq -w 1 1 100`
do
ffmpeg -itsoffset -00:02:03.$i -i video.avi -vcodec png -vframes 1 -an -f rawvideo pix-$i.png
done
ffmpeg -itsoffset -00:02:03.$i -i video.avi -vcodec png -vframes 1 -an -f rawvideo pix-$i.png
done
Monday, May 31, 2010
Issues with installing DB2 8.1 Development Client on Linux
When running the most obvious command db2setup, it shows the following then nothing happens:
DBI1190I db2setup is preparing the DB2 Setup wizard which will guide you through the program setup process. Please wait.
Perhaps it is because I am not running X as GUI, but strange it didn't complain about the DISPLAY message.
It can be installed by using db2_install
Post-install is unusual compare to other database installs, you need to run this to create an "instance" with an userid already exist on the system.
However, I get the following error on Red Hat Enterprise Linux Server release 5.4 (Tikanga)
/opt/IBM/db2/V8.1/instance/db2iutil/db2icrt -a SERVER -s client appuser
DBI1069E Unexpected error. Function = chk_fsystype, Return code =
22.
It seems to be the version of tail issue, you need to change this script:
/opt/IBM/db2/V8.1/instance/db2iutil/db2iutil
global search for "tail +2", change it to "tail -n +2"
[root@hostname]# ./db2icrt -a SERVER -s client appuser
DBI1070I Program db2icrt completed successfully.
Reference
http://oss.sgi.com/LDP/HOWTO/DB2-HOWTO/db2instance.html
DBI1190I db2setup is preparing the DB2 Setup wizard which will guide you through the program setup process. Please wait.
Perhaps it is because I am not running X as GUI, but strange it didn't complain about the DISPLAY message.
It can be installed by using db2_install
Post-install is unusual compare to other database installs, you need to run this to create an "instance" with an userid already exist on the system.
However, I get the following error on Red Hat Enterprise Linux Server release 5.4 (Tikanga)
/opt/IBM/db2/V8.1/instance/db2iutil/db2icrt -a SERVER -s client appuser
DBI1069E Unexpected error. Function = chk_fsystype, Return code =
22.
It seems to be the version of tail issue, you need to change this script:
/opt/IBM/db2/V8.1/instance/db2iutil/db2iutil
global search for "tail +2", change it to "tail -n +2"
[root@hostname]# ./db2icrt -a SERVER -s client appuser
DBI1070I Program db2icrt completed successfully.
Reference
http://oss.sgi.com/LDP/HOWTO/DB2-HOWTO/db2instance.html
Subscribe to:
Posts (Atom)