Thursday, September 11, 2008

Using screen on Linux ...Experience Remote Assistance in CLI

Below are the steps to attach two Linux shell sessions with screen.
Its like Remote Assistance in CLI.

1. Open two terminals with same login.

2. Run ps on both terminals.

3. Run screen -S on 1st terminal.

4. Run cd /var/run/screen/S-; ls on 2nd terminal.

5. Look for 1st terminal's bash PID entry.

6. Run screen -x on 2nd terminal.

Thursday, June 12, 2008

Shell script to monitor ur lab machines

Hello PPL,

After long time I addin new post. Below is the shell script using this can monitor server n their uptime.


# add ip / hostname separated by while space
HOSTS=" solaris netra1 aix"

# no ping request

# email report when
SUBJECT="Ping failed"
for myHost in $HOSTS
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
# 100% failed
echo "$myHost is not reachable"
echo "Host : $myHost is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID1 $EMAILID2 $EMAILID3