Some time our system started to use more swap area even 100% of swap area and the system crashes. So for a System Admin it would be very helpful when they get informed if the system started to use more swap usage so that system admin can manage the server before crashing. So I wrote a shell script which will Alert by send mail if the ...
The below script will check the hard disk space usage, using the command du and send an email alert if any of the partition is using more than 85% of space.
vim disk-usage.sh
#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print ...
In Ubuntu we don't have a mechanism to start or stop iptables or we don't have a mechanism to restore iptables after restarting the system. Now we will see how to create a script for start and stop iptables also to make the script to start on system startup.
1. Create a Firewall script
vim /etc/set_iptables.bash
echo 1 > ...
Description
ufw is stands for Uncomplicated Firewall, this program is for managing a Linux firewall and aims to provide an easy to use interface for the user, as well as support package integration and dynamic-detection of open ports. ufw is not intended to provide complete firewall functionality via its command interface, but ...
There is no straight forward method for 301/302 URL redirection as we did with rewrite rule. But there are some situations where we need to redirect a URL on a host to some URL on different host. In this situation we need to use 301/302 redirection. There are two ways we can implement this.
First method is to use set req.http.host ...
21 September 2008

Posted by Shahid
Linux
!-- @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } --> Varnish is a reverse proxy or http accelerator that uses serverside caching to increase the speed of servicing HTTP requests for use in things such as websites. The varnishd daemon accepts HTTP requests from clients, passes them on to a backend server ...
09 September 2008

Posted by Shahid
PHP
There are a number of things that can go wrong in code and they bound to through errors, even if you've tested them hundreds of times. PHP provides some error handling methods such as error_reporting(), set_error_handler(), error_log(), restore_error_handler() for handling errors in the PHP code.
error_reporting - Sets which PHP errors ...
Introduction
OpenNTPD is a Unix system daemon implementing the Network Time Protocol to synchronize the local clock of a computer system with remote NTP servers.
OpenNTPD is primarily developed by Henning Brauer as part of the OpenBSD project. Its design goals include being secure (non-exploitable), easy to configure, accurate ...
31 July 2008

Posted by Shahid
Linux
Introduction
httperf is a tool to measure web server performance.
Example
$ httperf --server haproxy.com --port=80 --uri /frontend_dev.php --num-conns=25
httperf --client=0/1 --server=haproxy.com --port=80 --uri=/frontend_dev.php --send-buffer=4096 --recv-buffer=16384 --num-conns=25 --num-calls=1
Maximum connect burst length: ...
What is Port Forwarding?
Port forwarding is a feature of the IPTables system. It allows one computer to forward connections made to it so that another computer can actually process the request. If you want a very simple metaphor you can think of it as mail forwarding. Each computer has a number of addresses called ports, and ...