Friday, July 24, 2009

Add Linux user through script

Run the below script as root.

#!/bin/bash

if [ $(id -u) -eq 0 ]; then
read -p "Enter username : " username
read -s -p "Enter password : " password
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$username exists!"
exit 1
else
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
useradd -m -p $pass $username
[ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
fi
else
echo "Only root may add a user to the system"
exit 2
fi

Tuesday, July 21, 2009

Tomcat Clustering

Many times it simply is not possible to satisfy all of your user load with a single server. When this is the case then your only option is to dedicate more than one server to satisfy your user requests, but dedicating more than one server to handle requests presents new challenges.

The primary challenge is how to respond when a server in the group goes down. Typically a server maintains stateful information about its users in a session object. It would be preferable if, when a server goes down, the user “falls over” to another server without being aware that he or she has changed servers. But in order for this to work, the user’s stateful information needs to be maintained in both the original server as well as the server that the user falls over to.

More……

Tools To Find Out Website Load Speed

Research shows that if your web pages take longer than 5 seconds to load, you lose 50% of your viewers and sales. As a UNIX admin often end users and web developers complain about website loading speed and timings. Usually, there is nothing wrong with my servers or server farm. Fancy java script and images / flash makes site pretty slow. These tools are useful to debug performance problems for sys admins, developers and end users. Here are six tools that can analyzes web pages and tells you why they are slow. Use the following tools to:

More…….