Script to find how many mails sent from an account
grep xxx@xxx.com /var/log/exim_mainlog | grep “<=” | awk {’print $3′} | wc -l
grep xxx@xxx.com /var/log/exim_mainlog | grep “<=” | awk {’print $3′} | wc -l
# 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) [...]
#!/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
(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 [...]
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 [...]
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 [...]
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 [...]
#!/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 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 [...]
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: [...]