Info BackTrack

Linux & Security Tutorial

Socket Buat Java di Linux Whax / Backtrack 5



#!/usr/bin/env sh

#KngCrew project untuk socket
SCRIPTNAME=$0

#nge-running script package
while [ -L "$SCRIPTNAME" ] ; do
        #link menuju link path target
        SCRIPTNAME=`ls -l "$SCRIPTNAME" | awk '{ print $NF; }'`
done

#eksekusi package
BASEDIR=`dirname $SCRIPTNAME`

#direcktory bash dir
cd "$BASEDIR"

#Work out best memory options
MEM=`free -m | grep Mem | awk '{ print $2;}'`

if [ -z $MEM ]
then
	echo "gagal eksekusi"
else
	echo "memory anda: " $MEM"Mb"
	if [ $MEM -gt 2048 ]
	then
		JMEM="-Xmx512m"
	else
		if [ $MEM -gt 1024 ]
		then
			JMEM="-Xmx256m"
		else
			if [ $MEM -gt 512 ]
			then
				JMEM="-Xmx128m"
			fi
		fi
	fi
fi

if [ -n "$JMEM" ]
then
	echo "ukuran jvm anda: $JMEM"
fi

#program dijalankan
java ${JMEM} -jar ${BASEDIR}/[path kamu] $*

Artikel Terkait:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: