The Guru Of Tech - Gobind

Asterisk Insall, Codec Install, Vicidial Install.

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, February 18, 2012

Running Linux Commands through PHP

I have prepared a module that will show the CPU utilization, current processes, memory utilization and disk quota of a remote system when asked on a PHP page

Below is the syntax and code in PHP and HTML just copy and paste it on the desired directory.

<table width="900" border="0" cellpadding="3" cellspacing="3">
<tr bgcolor="#666666">
    <td align="center"><font color="#FFFFFF"><b><h1><?php system("hostname"); ?></h1></b></font></td>
  </tr>
  <tr bgcolor="#000000">
    <td><font color="#FFFFFF"><b>Uptime:</b></font></td>
  </tr>
  <tr bgcolor="#FFE4E1">
    <td><?php system("uptime"); ?></td>
  </tr>
  <tr bgcolor="#000000">
    <td><font color="#FFFFFF"><b>System Information:</b></font></td>
  </tr>
  <tr bgcolor="#FFDAB9">
    <td><?php system("uname -a"); ?></td>
  </tr>
 <tr bgcolor="#000000">
    <td><font color="#FFFFFF"><b>Memory Usage (MB):</b></font></td>
  </tr>
  <tr bgcolor="#FFF0F5">
    <td><?php system("free -m"); ?></td>
  </tr>
 <tr bgcolor="#000000">
    <td><font color="#FFFFFF"><b>Disk Usage:</b></font></td>
  </tr>
  <tr bgcolor="#E6E6FA">
    <td><?php system("df -h"); ?></td>
  </tr>
 <tr bgcolor="#000000">
    <td><font color="#FFFFFF"><b>CPU Information:</b></font></td>
  </tr>
  <tr bgcolor="#F0FFF0">
    <td><?php system("cat /proc/cpuinfo | grep \"model name\\|processor\""); ?></td>
  </tr>
</table>

Monday, October 31, 2011

Block an IP address under Linux

If you just want to block access to all port from an ip 65.55.44.100 then type command :

#iptables -A INPUT -s 65.55.44.100 -j DROP
#service iptables save
#service iptables restart

If you just want to block access to one port from an ip 65.55.44.100 to port 25 then type command:

# iptables -A INPUT -s 65.55.44.100 -p tcp --destination-port 25 -j DROP
#service iptables save
#service iptables restart

Unblock An IP Address:
Use the following syntax (the -d options deletes the rule from table):

# iptables -D INPUT -s 65.55.44.100 -j DROP
# service iptables save
#service iptables restart