Linux technical support, Technical Blogs, Cheap dedicated server support, Cheap linux dedicated server support, Cheap windows dedicated server, Dedicated server support, Data center Operation, System Administration, Bash and perl scripts for server maintainance

Difference between Jboss and tomcat Application server

Application server :
An application server is a server computer in a computer network dedicated for running certain software applications

Tomcat is a Servlet container i.e. Serverlet/JSP enginer which service servlet via webserver.

Jboss is a complete application server which includes tomcat. In reference to JAVA, for example J2EE is a more complete reference of what an application server can amd should include, of which tomcat only implement some part of it where as Complete JBOSS including tomcat serves as a FULL J2EE specifications and hence is a ‘complete’ application server.

So to conclude if you need EJB/J2EE then choose JBOSS else tomcat is file to serve with Servlet/jsp and database integrety.

Monitoring Virtuozzo node

1. Obviously as recommended on linux.
top -S
ps faux # this will show process usage for CPU
2. Memory usage. free -m or in top
3. Disk IO errors.
low server response time to IO while CPU is idle
If time ls / reports unusual delays.
4. Identify the application usage of all vps.
cat /proc/user_beancounters - if you note any entries in the failcnt column then here read below.

Primary Parameters

* numproc - The maximal number of processes and threads the VE may create.
* avnumproc - The average number of processes and threads.
* vmguarpages - The memory allocation guarantee, in pages (one page is 4Kb). VE applications are guaranteed to be able to allocate additional memory so long as the amount of memory accounted as privvmpages (see the auxiliary prarameters) does not exceed the configured barrier of the vmguarpages parameter. Above the barrier, additional memory allocation is not guaranteed and may fail in case of overall memory shortage.
* numtcpsock - The number of TCP sockets (PF_INET family, SOCK_STREAM type). This parameter limits the number of TCP connections and, thus, the number of clients the server application can handle in parallel.
* numothersock - The number of sockets other than TCP ones. Local (UNIX-domain) sockets are used for communications inside the system. UDP sockets are used, for example, for Domain Name Service (DNS) queries. UDP and other sockets may also be used in some very specialized applications (SNMP agents and others).

Secondary Parameters

* kmemsize - The size of unswappable kernel memory allocated for the internal kernel structures for the processes of a particular VE.
* tcprcvbuf - The total size of receive buffers for TCP sockets, i.e. the ammount of kernel memory allocated for the data received from the remote side, but not read by the local application yet.
* tcpsndbuf - The total size of send buffers for TCP sockets, i.e. the ammount of kernel memory allocated for the data sent from an application to a TCP socket, but not acknowledged by the remote side yet.
* othersockbuf - The total size of UNIX-domain socket buffers, UDP, and other datagram protocol send buffers.
* oomguarpages - The out-of-memory guarantee, in pages. Any VE process will not be killed even in case of heavy memory shortage if the current memory consumption (including both physical memory and swap) does not reach the oomguarpages barrier.
* dgramrcvbuf - The total size of receive buffers of UDP and other datagram protocols.

Auxiliary Parameters

* lockedpages - The memory not allowed to be swapped out (locked with the mlock() system call), in pages.
* privvmpages - The size of private (or potentially private) memory allocated by an application. The memory that is always shared among different applications is not included in this resource parameter.
* shmpages - The total size of shared memory (including IPC, shared anonymous mappings, and tmpfs objects) allocated by the process of a particular VE, in pages.
* numfile - The number of files opened by all VE processes.
* numflock - The number of file locks created by all VE processes.
* numpty - The number of pseudo-terminals, such as an ssh session, the screen or xterm applications, etc.
* numsiginfo - The number of siginfo structures (essentially, this parameter limits the size of the signal delivery queue).
* dcachesize - The total size of dentry and inode structures locked in the memory.
* physpages - The total size of ram used by the VE processes. This is an accounting-only parameter currently. It shows the usage of RAM by the VE. For the memory pages used by several different VEs (mappings of shared libraries, for example), only the corresponding fraction of a page is charged to each VE. The sum of the physpages usage for all VEs corresponds to the total number of pages used in the system by all the accounted users.
* numiptent - The number of IP packet filtering entries.

5. Check any unnecessary services or scripts that’s running from cron, ats, init.d. If you find some scripts that is using high cpu then use renice to reduce the no priority for that script. or even though you want to twek then use taskset commend to set the no of core CPU for that script.
6. Check the DB or mail server (if thats running) and do tweak that.
7. Use memcached if your db usage is high.

Solaris + alternative for lsof and netstat

If lsof and netstat are not installed in your machine or if you are not able to install it and want to check which port is used by some process or vice versa then use this script for it. This is the case especially in Solaris 8,9,10 OS.

#!/usr/bin/ksh
#
# PCP (PID con Port)
# v1.07 20/05/2008 sam@unix.ms
#
# If you have a Solaris 8, 9 or 10 box and you can’t
# install lsof, try this. It maps PIDS to ports and vice versa.
# It also shows you which peers are connected on which port.
# Wildcards are accepted for -p and -P options.
#
if [ $# -lt 1 ]
then
echo >&2 “usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK)”
exit 1
fi
while getopts :p:P:a opt
do
case “${opt}” in
p ) port=${OPTARG};;
P ) pid=${OPTARG};;
a ) all=all;;
[?]) # unknown flag
echo >&2 “usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK) ”
exit 1;;
esac
done
shift `expr $OPTIND - 1`
if [ $port ]
then
# Enter the port number, get the PID
#
port=${OPTARG}
echo “PID\tProcess Name and Port”
echo “_________________________________________________________”
for proc in `ptree -a | grep -v ptree | awk ‘{print $1};’`
do
result=`pfiles $proc 2> /dev/null| grep “port: $port”`
if [ ! -z “$result” ]
then
program=`ps -fo comm -p $proc | tail -1`
echo “$proc\t$program\t$port\n$result”
echo “_________________________________________________________”
fi
done
elif [ $pid ]
then
# Enter the PID, get the port
#
pid=$OPTARG
# Print out the information
echo “PID\tProcess Name and Port”
echo “_________________________________________________________”
for proc in `ptree -a | grep -v ptree | grep $pid| awk ‘{print $1};’`
do
result=`pfiles $proc 2> /dev/null| grep port:`
if [ ! -z “$result” ]
then
program=`ps -fo comm -p $pid | tail -1`
echo “$proc\t$program\n$result”
echo “_________________________________________________________”
fi
done
elif [ $all ]
then
# Show all PIDs, Ports and Peers
#
echo “PID\tProcess Name and Port”
echo “_________________________________________________________”
for pid in `ptree -a | grep -v ptree |sort -n | awk ‘{print $1};’`
do
out=`pfiles $pid 2>/dev/null| grep “port:”`
if [ ! -z “$out” ]
then
name=`ps -fo comm -p $pid | tail -1`
echo “$pid\t$name\n$out”
echo “_________________________________________________________”
fi
done
fi
exit 0

How to get the CPU usage for perticular process by script

Command to get the top result as complete output on screen as standart output is
top -b -n 1 -p
Pass the process id with top -b -n 1 -p PID.
e.g. if thats for tomcat then
top -b -n 1 -p `ps -ef | grep tomcat0 | grep java | grep bootstrap.jar | grep -v grep | awk ‘{print $2}’`
then do sed -n ‘8p’ to get the last line of the result and then awk it so your command will be.
top -b -n 1 -p `ps -ef | grep tomcat0 | grep java | grep bootstrap.jar | grep -v grep | awk ‘{print $2}’` | sed -n ‘8p’ | awk ‘{print $9}’

Hide your Shell commands

Have you thought of hiding what you are doing on your linux bash shell and not allowing your colleague to see what command you are firing or do you want to confuse your colleague by showing some thing invisible but work as visible? he he then read out this…
Today I came across a neat, but pointless shell command. By running the following in shell, it will hide any commands you run.

root@server2 [/]# stty -echo

In order to disable this mode, simply remove the “-” before echo.

root@server2 [/]# stty echo

I guess there really is no point to the command, though you could always mess with your coworkers if they leave their shell prompt open :)

Cheers.

log rotation script

#!/bin/bash
# log rotation for apache
# This is just an example if you have multile apache instances running on same server under /appl/.
Hostname=`uname -n`
DATE=`date +%Y%m%d`
mail_to=”ADD_HERE”

> /root/Run_Rotate.log

#for i in `ls -d “ADD_HERE_THE_PATH_FOR_FOLDER_OF_THE_LOG”* | cut -f3 -d”/”

for i in `ls -d /appl/apache* | cut -f3 -d”/” | grep -v apache-tomcat`
do
if [ -e /appl/${i}/logs/access_log ];then
cp /appl/${i}/logs/access_log /appl/${i}/logs/access_log.$DATE
echo “Access.log has been copied for ${i}” >> /root/Run_Rotate.log
> /appl/${i}/logs/access_log
echo “Access_log has been nullified for ${i}” >> /root/Run_Rotate.log
cp /appl/${i}/logs/error_log /appl/${i}/logs/error_log.$DATE
echo “error_log has been copied for ${i}” >> /root/Run_Rotate.log
> /appl/${i}/logs/error_log
echo “Error_log has been nullified for ${i}” >> /root/Run_Rotate.log
/usr/bin/gzip -9 /appl/${i}/logs/access_log.$DATE
echo “Access.log.$DATE has been zipped for ${i}” >>/root/Run_Rotate.log
/usr/bin/gzip -9 /appl/${i}/logs/error_log.$DATE
echo “error_log.$DATE has been zipped for ${i}” >> /root/Run_Rotate.log
find /appl/${i}/logs/error_* -mtime +6 -print -exec rm -f {} \;
find /appl/${i}/logs/access_* -mtime +6 -print -exec rm -f {} \;
> /appl/${i}/logs/mod_jk.log
echo “Log Rotation done successfully for ${i}” >> /root/Run_Rotate.log
else
echo “Error in Rotating Logs — Access Log file does not exist for ${i}” >> /root/Run_Rotate.log
echo “Error in Rotating Logs — Access Log file does not exist for ${i}”| mail -s “Problem in apache rotation” $mail_to
echo > /dev/null
fi
done

(standard_in) 1: illegal character: M

March 12th, 2009 by in Scripts, Bash Scripts + perl scripts

If you are getting the above error in your bash script then some thing wrong with some where in line where you are doing the calculation with including following command.

bc -l

Recheck your code.

Regards,
Jayesh

Virtuozzo few important commands

January 6th, 2009 by jayesh in Troubleshooting, VPS hosting

1) vzctl set VPS_ID –hostname vps.domain.com –save: To set the Hostname of a VPS.

2) vzctl set VPS_ID –ipadd 1.2.3.4 –save : To add a new IP to the hosting VPS

3) vzctl set VPS_ID –ipdel 1.2.3.4 –save : To delete the IP from VPS.

4) vzctl set VPS_ID –userpasswd root:new_password –save : to reset root password of a VPS.

5) vzctl set VPS_ID –nameserver 1.2.3.4 –save : To add the nameserver IP’s to the VPS

6) vzctl exec VPS_ID command : To run any command on a VPS from Node.

7) vzyum VPS_ID install package_name : To install any package/Software on a VPS from Node.

VPS_ID refers to the ID of the Particular VPS.

How to make Internet explorer/ Mozilla default browser?

Internet Explorer 6.x and 5.x:

* Select “”Tools | Internet Options”" from the main menu in Explorer.

* Change to the “”Programs”" tab.

* Check the “”Internet Explorer should check to see whether it is the default browser”" option.

* Click “”OK”".

* Close all Explorer windows and restart the system. Once the system comes back up, restart Explorer.

* When the “”Would you like to make [Internet Explorer] your default browser?”" prompt appears, click “”Yes”" to make Explorer the default browser.

Internet Explorer 4.x:

* Select “”View | Internet Options”" from the main menu in Explorer.

* Change to the “”Programs”" tab.

* Check the “”Internet Explorer should check to see whether it is the default browser”" option.

* Click “”OK”".

* Close all Explorer windows and restart the system. Once the system comes back up, restart Explorer.

* When the “”Would you like to make [Internet Explorer] your default browser?”" prompt appears, click “”Yes”" to make Explorer the default browser.

Mozilla 1.x:

* Select “”Edit | Preferences”" from the main menu in Mozilla.

* Change to the “”Navigator”" tab/section.

* Click the “”Set Default Browser”" button.

* Click “”OK”".

* Close all Mozilla windows (for best results, restart the system). Finally, restart Mozilla.

Mozilla Firefox 1.x:

* Select “”Tools | Options”" from the main menu in Firefox.

* Change to the “”General”" tab/section.

* Check the “”Firefox should check to see if it is the default browser when starting”" option.

* Click “”OK”".

* Close all Firefox windows (for best results, restart the system). Finally, restart Firefox.

* When the “”Would you like to make [Firefox] your default browser?”" prompt appears, click “”Yes”" to make Firefox the default browser.

Mozilla Firebird 0.x:

* Select “”Tools | Options”" from the main menu in Firebird.

* Change to the “”General”" tab/section.

* Click the “”Set Default Browser”" button.

* Click “”OK”".

* Close all Firebird windows (for best results, restart the system). Finally, restart Firebird.

Netscape 7.x:

* Select “”Edit | Preferences”" from the main menu in Netscape.

* Change to the “”Navigator”" tab/section.

* Click the “”Set Default Browser”" button.

* Click “”OK”".

* Close all Netscape windows (for best results, restart the system). Finally, restart Netscape.

* When the “”Netscape 7.x is not currently set as your default browser. Would you like to make it your default browser?”" prompt appears, click “”Yes”" to make Netscape the default browser.

Netscape Navigator/Communicator 4.x:

* Open the prefs.js file located in [Communicator installation directory]\users\[profile name] (for example: C:\Program Files\Netscape\users\prefs.js) using a text editor.

* Make sure that the following line exists and has the value false. If it does not exist, insert it at the end of the file.

user_pref(”browser.wfe.ignore_def_check”, false);

* Save changes to the file and close it.

* Close all Communicator windows and restart it.

* When the “”Would you like to make [Communicator] your default browser?”" prompt appears, click “”Yes”" to make Communicator the default browser.

Opera 7.x:

* Select “”File | Preferences”" from the main menu in Opera.

* Change to the “”Default Application”" tab.

* Check the “”Check if Opera is default browser on startup”" option.

* Click “”OK”".

* Close all Opera windows (for best results, restart the system). Finally, restart Opera.

* When the “”Would you like to use Opera as your default application for viewing web pages?”" prompt appears, click “”Yes”" to make Opera the default browser.

TimesTen vs Memcached comparison

TimesTen is a memory optimized SQL relational database, that can run standalone or as a cache in front of an Oracle database. Developers use standard JDBC, ODBC or SQL to access TimesTen. TimesTen provides real-time, updatable caching for Oracle database, the data synchronization between Oracle and TimesTen is automatically handled.

The TimesTen database is persistent and supports full ACID transactions with recovery. TimesTen also offers real-time transactional replication between TimesTen databases for high availability and load sharing.

Memcached is a distributed memory object cache, it is commonly used to cache SQL resultsets, targeted at repetitive queries found in read intensive database web applications. The user application is responsible for managing and populating the cache, memcached does not provide data synchronization with the Oracle database.

For example this is the logic the application developer needs to implement:

* Wherever you go to do a database query, first check the memcache. If the memcache returns an undefined object, then go to the database, get what you’re looking for, and put it in the memcache
* To ensure the application does not see stale data, the application must update both the memcache and the database at the same time

memcached does not understand SQL. If a memcached node dies, all data are lost and it is up to the application to reload the data from the source.

Next Article »
purchase accutane online buy accutane cialis prescription order cialis without prescription buy cheap soma online generic synthroid accutane pills cheapest generic viagra lowest price acomplia propecia without a prescription cheap cialis from usa tablet viagra certified viagra buy cialis without prescription levitra discount cheap viagra in usa lowest price clomid order cheap viagra acomplia sale cialis rx order lasix viagra bangkok cheapest cialis prices online viagra cialis vendors buy soma online clomid sale buy cheap lasix online viagra free sample cialis in us viagra canada buy cialis from us soma no prescription cialis pill buy soma buy viagra in us soma for sale where to order viagra viagra buy drug viagra buy cialis in uk synthroid cheap cheap generic cialis buy cheap synthroid online discount propecia acomplia pharmacy order lasix online buy cialis in us soma without a prescription cheap propecia tablets cheap viagra tablets find cheap cialis cialis sales clomid online stores clomid prices compare viagra prices online cheap cialis no rx lasix without prescription cialis pills cialis purchase online pharmacy viagra buy cheap accutane find viagra on internet cialis order buy viagra cheap cheapest levitra cost of viagra cheap lasix tablets order cialis on internet order viagra in canada zithromax no prescription lowest price zithromax cheapest viagra prices