Archive for June 2008

Pattern matching example:

1
awk '/foo1/ && /foo2/ { print $1 }'

To use shell variables simply do the following:

1
2
3
4
foo1={pattern1}
foo2={pattern2}
 
awk "/$foo1/ && /$foo2/"'{ print $1 }'

Crontab syntax :
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.

* in the value field above means all legal values as in braces for that column.

The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

Example:
55 23 * * * $HOME/automation/getStats.sh > $HOME/automation/logs/cron.logs 2>&1
* to avoid getting emails on Linux from cron, you can disable by appending    ‘>/dev/null 2>&1’ .



There are times when you may have to recover the MySQL root password because it was either forgotten or misplaced. The steps you need are:

1. Stop MySQL
[root@idoumo tmp]# service mysqld stop
Stopping MySQL: [ OK ]

2. Start MySQL in Safe mode with the safe_mysqld command and tell it not to read the grant tables with all the MySQL database passwords.

[root@idoumo tmp]# safe_mysqld –skip-grant-tables &
[root@idoumo tmp]# Starting mysqld daemon with databases from /var/lib/mysql

3. Use the mysqladmin command to reset the root password. In this case, you are setting it to ack33nsaltf1sh.

[root@idoumo tmp]# mysqladmin -u root flush-privileges password “ack33nsaltf1sh”

4. Restart MySQL normally.
[root@idoumo tmp]# service mysqld restart
Stopping MySQL: 040517 09:39:38 mysqld ended [ OK ]
Starting MySQL: [ OK ]
[1]+ Done safe_mysqld –skip-grant-tables

The MySQL root user will now be able to manage MySQL using this new password.

Logical Volume Management provides benefits in the areas of disk management and scalability. It is not intended to provide fault-tolerance or extraordinary performance. For this reason, it is often run in conjunction with RAID, which can provide both of these. Read on »

Use the software cd 1 of 2 to recover root password:

1
2
3
4
5
6
7
8
9
10
11
12
boot cdrom -s from ok prompt
 
mkdir /tmp/a
 
mount /dev/dsk/c0t0d0s0 /tmp/a
 
cd /tmp/a/etc
 
TERM=vt100; export TERM
 
vi shadow

Delete passwd entry (13 chars) in the line for root.

Nowadays, modern web-based application development can’t exist without J2EE-based applications. These applications are built on a highly secure and powerful development platform. There are various Open Source applications that can help J2EE development a great deal. In this article, I would like to share with everyone an easy way to kick off your J2EE learning for almost no cost to you. Read on »