shell script

Shell Scripting: Convert Uppercase to Lowercase

Q. How do I convert uppercase words to lowercase or vise versa under BASH shell? I’ve a small shell script and I’d like to convert all incoming user input to lowercase using a shell script. A. Use tr command to convert all incoming text / words / variable data from […]

Anti SYN Flood with IPTables

#!/bin/sh # A simple shell to build a Firewall anti SYN Flood # Under CentOS, Fedora and RHEL / Redhat Enterprise Linux # servers. # —————————————————————————- # Written by LongVNIT # (c) 2009 lifeLinux under GNU GPL v2.0+ IPT=”iptables” MODPROBE=”modprobe” IF=”eth0″ IP=”″ PORT=”22 80 443″ CHECK_TIME=60 BAN_TIME=120 HITCOUNT=10 MOD=”ip_tables ip_conntrack […]

Script to create multiple accounts

Script to create multiple accounts for cpanel #! /bin/bash #make a file (test1) which contains domain names, username and password. #then run the script: for i in `cat test1` do domain=`echo $i | cut -f1 -d:` un=`echo $i | cut -f2 -d:` pw=`echo $i | cut -f3 -d:` /scripts/wwwacct $domain […]

mcelog: Shell Script To Send Email Alert When Hardware Errors Detected

mcelog: Shell Script To Send Email Alert When Hardware Errors Detected #!/bin/bash # Linux 64 bit kernel shell script to collect hardware errors via /var/log/mcelog # and send email alert. # ————————————————————————- # Copyright (c) 2008 nixCraft project <> # This script is licensed under GNU GPL version 2.0 or […]

UNIX Get An Alert When Disk Is Full

I want to get an alert when my disk is full under UNIX and Mac OS X? How do I set a a specified threshold and run the script via cron?   The df command report file system disk space usage including the amount of disk space available on the […]

How to Block Ftp Access/Port using iptables OR CSF?

The default firewall that comes along with Linux is “iptables” and you can use iptables to block Ftp access/port on your server. Completely block Ftp access on the server: # iptables -A INPUT -p tcp –dport 21 -j DROP Block Ftp access for a specific IP address, say # […]

Shell Script To Backup MySql Database Server

#!/bin/bash # Shell script to backup MySql database # To backup Nysql databases file to /backup dir and later pick up by your # script. You can skip few databases from backup too. # For more info please see (Installation info): # # Last updated: Aug – 2005 # […]