Welcome

This site is providing technical information based on LAMP stack. My primary focus is on web systems and services, such as LAMP stack, Amazon Web Services(EC2, S3 and SQS) and software tools, plus Oracle Databse. I invite you to stop by the blog, where you can read and comment on programming, scientific posts or the information.

210 - Top-Level Domain (TLD)

A root name server is a name server for the Domain Name System's root zone. It directly answers requests for records in the root zone
and answers other requests returning a list of the designated authoritative name servers for the appropriate top-level domain (TLD).

The newest DNS root zoon on.

# dig @a.root-servers.net ns

209 - Bash [: too many arguments

If you run the following script, you got an error sometimes.

if [ -e /tmp/* ]; then
   echo "files exist"
else
   echo "No file exists"
fi

This is using -e (existing a file check) that is working fine on individual files. This code works fine if the result is one file;
but if you have more files returned,  it fails with the following error:

line x: [: too many arguments

208 - Changing the Number of RHEL 6 (CentOS 6)Desktop Workspaces

By default, RHEL 6 configures two workspaces.

To increase the number of available workspaces :

1. Right click with the mouse on the workspace control in the panel.

2. Select Preferences.

3. Simply increase the Number of workspaces value to the desired number.

The name of each workspace may be changed by double clicking on the default name in the list
(Workspace 1, Workspace 2 etc) and typing in a new name.

207 - portreserve ( to reserver port# in Linux Server )

The portreserve program aims to help services with well-known ports that lie in the portmap range. 
It prevents portmap from a real service's port by occupying it itself, until the real service tells it to release the
port (generally in the init script).

1. Install the package for RedHat / CentOS 6

# yum search portreserve

# yum install portreserve

206 - Meaning $$ in PHP

<?PHP
$a_string = "This is a test.";
$a_var = "a_string";

echo $$a_var;
?>

Output :

This is a test.

 

205 - PHP Meaning -> & =>

  • -> To create a new object, use the new statement to instantiate a class.
<?php
class foo
{
    function do_foo()
    {
        echo "Execute do_foo function in class foo";
    }
}

$bar = new foo;
$bar->do_foo();
?>

You can execute a method in a class object.

204 - Top 5 large files in a directory

If you want to figure out large files in a specific directory.

# du -s /var/log/* | sort -nr | head -5

There are a lot of files in a current directory and want to figure out.

# du -s ./* | sort -nr | head -5

 

  • du

 This command is used to summarize disk usage of each file in a file system, recursively for directories.

203 - Change the MySQL's DATADIR

The default MySQL's datadir is placed in the /var/lib/mysql.
if you plan on using MySQL tables to store a lot of data and your /var partition might be a small space, it causes a space problem.
You had better move the MySQL's datadir to another space.

1. Stop your mysql server

# service mysqld stop  (or /etc/init.d/mysqld stop)

2. Create the new directories

3. chown the directory to the mysql:mysql user

202 - Required packages for Nagios & CentOS v6

If you install Nagios into CentOS v6, you need the following packages.
Check the packages before the installation.

yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel
yum install openssl-devel

 

Syndicate content