Saturday, December 3, 2011

Error occurred during initialization of VM on javac

root@server [~]# /etc/init.d/red5  restart
Shutting down red5:                                        [FAILED]
Starting red5:                                                   [  OK  ]

root@server [~]# javac
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

export _JAVA_OPTIONS="-Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSClassUnloadingEnabled"

Thursday, December 1, 2011

Checking the php script sending the spam mails

This post explains how to check the php script sending the spam mails in exim.

Go to the mail sending directory of exim

root@server1 [~]# cd /var/spool/exim/input

Search for php scripts sent the spam mails
root@server1 [/var/spool/exim/input]#  egrep "X-PHP-Script" * -R

how to use a file as a hard disk partition.


This explains how to use a file as a hard disk partition. 

First we have to create a file(var.dsk) of  big size according to our need. Here we use dd command for this. A 1gb size file.
root@cpaneltest [~]# dd if=/dev/zero of=var.dsk bs=1024 count=1000000

Now you have to attach that file to a loop device. Using the command losetup.
root@cpaneltest [~]# losetup /dev/loop7 var.dsk

Now format the file with any filesystem. Here we use ext3.
root@cpaneltest [~]# mkfs.ext3 /dev/loop7

Now create a mount point.
root@cpaneltest [~]# mkdir /var_test

Mounting the attached loop device to the mount point
root@cpaneltest [~]# mount -t ext3 /dev/loop7 /var_test

Checking mount. See the last line.
root@cpaneltest [~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,usrquota,acl)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/usr/tmpDSK on /tmp type ext3 (rw,noexec,nosuid,loop=/dev/loop0)
/tmp on /tmp type none (rw,noexec,nosuid,bind)
/dev/sdb1 on /root/dev_test type ext3 (rw)
/dev/loop7 on /var_test type ext3 (rw)

If you want to mount it permanantly so that it can survive reboots.
root@cpaneltest [~]# vi /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,acl        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/usr/tmpDSK             /tmp                    ext3    noexec,nosuid,nodev,noatime,noauto        0 0
/tmp             /var/tmp                    ext3    noexec,nosuid,nodev,noatime,usrquota,bind,noauto        0 0
/dev/loop7      /var_test                       ext3    defaults        0 0
root@cpaneltest [~]# mount -a

For detaching the loop device and unmounting it.
root@cpaneltest [~]# umount  /var_test
root@cpaneltest [~]# losetup -d /dev/loop7
Remove the entry from fstab and run mount -a

Wednesday, November 30, 2011

calling two parameters from a file using bash script

this script explains how to call two parameters or arguments or values from a file using bash script in a for loop

file_path :  path to the file
i and j are the variables for the calling values


for i in `cut -d: -f2 file_path`
do
j=`cat file_path | grep $i | awk {'print $1'} | cut -d: -f1`
echo $i $j
done