I always had problems when i upgraded my wordpress.
So I made ​one script that automatically does this for me and i’ll share that with you.
With this script you can install or upgrade your wordpress install.


# Homepage: http://www.debian-tutorials.com
# Email: contact@debian-tutorials.com
# Bash script to download and install or upgrade wordpress to specified directory.
install_wp ()
cd ~</pre>
mkdir wordpress
cd wordpress
wget https://wordpress.org/latest.tar.gz –no-check-certificate;
echo "Where would you like your new WordPress install to be located? Please Type the location(Eg:/var/www/) and press [ENTER]: "
read wordpress_dir
echo "Installing WordPress to $wordpress_dir";
if [ ! -d "$wordpress_dir" ]; then
mkdir $wordpress_dir
tar -zxvf latest.tar.gz -C $wordpress_dir

clean_up ()
cd ~/wordpress
rm latest.tar.gz
cd ~
rmdir wordpress
cd $wordpress_dir/wordpress
mv *.* $wordpress_dir
mv wp-admin $wordpress_dir
mv wp-content $wordpress_dir
mv wp-includes $wordpress_dir/
rmdir $wordpress_dir/wordpress
cd $wordpress_dir/wp-content
mkdir uploads
chmod 777 uploads -R
cd $wordpress_dir
touch $wordpress_dir/.htaccess
chmod -v 666 .htaccess
echo "Wordpress is now Installed to" . $wordpress_dir . "Enjoy!"

update_wp ()
day=`date +%Y_%m_%d`
cd ~
mkdir wordpress_tmp
cd wordpress_tmp
wget https://wordpress.org/latest.tar.gz –no-check-certificate;
echo "In what directory does WordPress already exist, that you would like updated? Please Type the location(Eg:/var/www/) and press [ENTER]: "
read update_dir
tar -zxvf latest.tar.gz -C $update_dir
cd ~/wordpress_tmp
rm latest.tar.gz
cd ~
rmdir wordpress_tmp

cd $update_dir
cp $update_dir/ $update_dir/../wordpress_backup_$day -R
cp $update_dir/../wordpress_backup_$day/wp-config.php $update_dir

# Go to backup directory and remove the new install of WP
cd $update_dir/../wordpress_backup_$day
rm wordpress -rf

# back to the update directory
cd $update_dir/wordpress

#remove wp-admin and wp-includes
cd $update_dir
rm wp-admin -rf
rm wp-includes -rf

cd $update_dir/wordpress
mv wp-admin $update_dir
mv wp-includes $update_dir
#remove the extra updated directoroies
rm $update_dir/wordpress/ -rf

echo "Upgrade complete! Backup can be found in $update_dir/../$update_dir_backup_$day"
if ["$(id -u)" = "0"]; then {
echo "You are root we will continue" 2>&1

read -p "If the location you want to install wordpress to requires Root access, Please press ‘N’ and run this script again as root, or ‘Y’ to run the script without root (y/n)? "
[ "$REPLY" == "n" ] & exit ||
[ "$REPLY" == "y" ] &
echo "Do you wish to install WordPress [Yes] or update [No]? Type 1 or 2 and press [ENTER]"
select yn in "Yes" "No"; do
case $yn in
Yes ) install_wp && clean_up && break;;
No ) update_wp && break;;
exit 1;


You can download the script from here: Install or Upgrade wordpress bash script


The Spamhaus Project is one of the largest anti-spam DNS blacklist services known. Founded in 1998, Spamhaus has operations in Geneva, Switzerland, and London in addition to the 28 investigators and forensic specialists located in 8 countries. Spamhaus is a true 24 hour a day anti-spam operation. With over 60 public DNS Servers distributed across 18 countries, Spamhaus is able to serve billion of DNS requests to the world over, all free of charge. It has been estimated that 1.4 billion users mailboxes are in some way protected by The Spamhaus Project every day.

Here, I will show you a script that automatically blocks IPs blocked by Spamhaus:



echo “”
echo -n “Deleting DROP list from existing firewall…”

Continue Reading…

There is a simple way to call a simple bash script inside php script page:

– Below is a simple bash script called script.sh

echo “Successful call test script“
exit 0

You will need to set chmod 700 to  be root executable. Then  save the script to your apache root folder.

There is a simple php script called testing.php

< ?php $script = “/var/www/script.sh”; $ver1 = system($script, $retval); if ($retval == 0 ) { echo “Returned 0″; } else { echo “Returned not zero”; } die; ?>

Continue Reading…

Virtual hosts are used to run more than one web site on a single machine.
Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address.

I want to show you one of mine scripts for easy create virtual hosts in Debian Squeeze or ubuntu.


# Check if is root
if [ “$UID” -ne “$ROOT_UID” ]
echo “You must be root to run this script.”

if [ -n “$1” ]
echo “You must provide a full domain name for this site, i.e. ‘example.com’ ”
echo -n “Run this script like ./script example.com .”

#Create document root site folder
mkdir -p $WWW_ROOT/$DOMAIN

Continue Reading…

I’ll show you a simple script for easily monitor server

# Monitoring Server with ping


# host/ip

# NO ping request

# Report
SUBJECT="Server Down!"
for host in $HOST

count=$(ping -c $COUNT $HOST | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')

  if [ $COUNT -eq 0 ]; then
# Server is DOWN!

    echo "Host : $HOST is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID