Bash scripts to scan and monitor network

This article provides few simple scripts to scan and monitor network using combination of bash and ping command. Obviously, these scripts are no match to a full monitoring dedicated software like nagios but they could be useful for a small home brand networks, where implementing sophisticated monitoring system can become an overhead.

1. Scan network subnet

In this example the bash script will scan network for hosts attached to an IP address – 255. The script will print message Node with IP: IP-address is up if ping command was successful. Feel free to modify the script to scan your hosts range.


  ping -c 1 $1 > /dev/null
  [ $? -eq 0 ] && echo Node with IP: $i is up.

for i in 10.1.1.{1..255}
is_alive_ping $i & disown




Node with IP: is up.
Node with IP: is up.
Node with IP: is up.

 Continue reading "Bash scripts to scan and monitor network"

Install LAMP on Ubuntu 8.04


Here is the apt-get command to install a basic lamp environment on ubuntu hardy 8.04 with some “quick start help” commands.


apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server php5-gd phpmyadmin

This will install apache 2 php 5.2 and mysql server 5 and their dependencies. The deamons are launched at install and basically, only apache2 needs a bit of configuration.To enable ~/public_html user folder (which you reach in a browser with this URL : http://localhost/~username) do :

sudo a2enmod userdir && sudo /etc/init.d/apache2 restart

The default document root is /var/www (you need superuser privileges to write in this directory), but you can add more sites. Edit a new configuration file for the new site :

gksudo gedit /etc/apache2/sites-available/<site_name>

Replace with whatever you want. Add virtual host properties and directives that you need, then save and exit gedit.
To enable this new site do :

sudo a2ensite <site_name> && sudo /etc/init.d/apache2 restart

To manage mysql users and database, simply use phpmyadmin by entering this url in your browser : http://localhost/phpmyadmin

The php config file is located at : /etc/php5/apache2/php.ini and requires a restart of apache if you make any change in it.