Tag archive for ‘print’

Script to find how many mails sent from an account

grep xxx@xxx.com /var/log/exim_mainlog | grep “<=” | awk {’print $3′} | wc -l

Frequently used SCREEN reference commands

# open screen session screen # list screen sessions screen -ls # reattach to screen session screen -r <name of screen session> # attach to a not detached session screen -x <name of screen session> # detach from unattached session screen -d Note: ^A = Ctrl-a (Press the “a” key while holding down Control key) [...]

Script for restarting apache at load 10

#!/bin/bash loadavg=$(uptime | awk -F “.” ‘{ print $1 }’ | awk -F “:” ‘{ print $5 }’) if [ "$loadavg" -ge "10" ]; then pkill -9 httpd sleep 3 /scripts/restartsrv_httpd fi

Rules for Naming variable name (Both UDV and System Variable)

(1) Variable name must begin with Alphanumeric character or underscore character (_), followed by one or more Alphanumeric character. For e.g. Valid shell variable are as follows HOME SYSTEM_VERSION vech no (2) Don’t put spaces on either side of the equal sign when assigning value to variable. For e.g. In following variable declaration there will [...]

Shell Arithmetic

Use to perform arithmetic operations. Syntax: expr op1 math-operator op2 Examples: $ expr 1 + 3 $ expr 2 – 1 $ expr 10 / 2 $ expr 20 % 3 $ expr 10 \* 3 $ echo `expr 6 + 3` Note: expr 20 %3 – Remainder read as 20 mod 3 and remainder [...]

How to print or access value of UDV (User defined variables)

To print or access UDV use following syntax Syntax: $variablename Define variable vech and n as follows: $ vech=Bus $ n=10 To print contains of variable ‘vech’ type $ echo $vech It will print ‘Bus’,To print contains of variable ‘n’ type command as follows $ echo $n Caution: Do not try $ echo vech, as [...]

To kill Zombie process

for i in `ps ax | grep Z | awk {’print $1′}`;do kill -9 $(cat /proc/${i}/status | grep PPid | awk {’print $2′});done Incoming search terms:windows kill zombie process (5)centos kill zombie process (2)centos zombie (2)zombie process (2)iptables script to kill zombie (2)php destroy debian zombie process (1)processus zombie plesk (1)shell script to kill defunct process [...]

UNIX / Linux Shell Script For Monitoring System network with ping command

#!/bin/bash # Simple SHELL script for Linux and UNIX system monitoring with # ping command # ————————————————————————- # Copyright (c) 2006 nixCraft project <http://www.cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ————————————————————————- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. [...]

Shell script to get uptime, disk , cpu , RAM , system load, from multiple Linux servers – output the information on a single server in html format

Shell script to get uptime, disk usage, cpu usage, RAM usage, system load, etc; from multiple Linux servers and output the information on a single server in html format #!/bin/bash # Shell script to get uptime, disk usage, cpu usage, RAM usage,system load,etc. # from multiple Linux servers and output the information on a single [...]

Solaris > Gathered System Information or How to print system configuration

The prtconf command prints the system configuration information. The output includes the total amount of memory, and the configuration of system peripherals formatted as a device tree. 1) Use prtconf command: # prtconf | more OR # prtconf –D | more OR # prtconf | grep “Memory” Memory size: 512 Megabytes 2) Use modinfo command: [...]