About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Thursday 25 June, 2009

Capture the results of the queries executed in mysqlclient in a file (no copy and paste)

One way is to copy the mysqlclient screen and paste it into a text file. The other way is to use tee.

mysql>
mysql> tee mysql-1.txt
Logging to file 'mysql-1.txt'
mysql> show databases;
+----------------+
| Database |
+----------------+
| test_db |
| db_3 |
| db_4 |
| db_5 |
+----------------+
4 rows in set (0.00 sec)

mysql> exit
Bye

[thiru@cu065 tmp]$ less mysql-1.txt

mysql> show databases;
+----------------+
| Database |
+----------------+
| test_db |
| db_3 |
| db_4 |
| db_5 |
+----------------+
4 rows in set (0.00 sec)

mysql> exit

Monday 22 June, 2009

Sending mail through command line client.

Some days back I'm in situation to test the continuous spamming of mails to my mail box.

This command did me the work

for i in `seq 1 35`; do echo "test" | mail -s test forum@email.com; done

Wednesday 3 June, 2009

Apache <IfDefine> Directive

This is used to process some section in httpd.conf based on the system argument.

The directives within an <ifdefine></ifdefine> section are only processed if the "test" variable is true. If "test" variable is false, everything between the start and end markers is ignored.

Example:

httpd -D test -k start

Starting the httpd with system parameter "test" will execute the below section or else it will skip those
<ifdefined>
...
...
</ifdefined>

This will be useful sometime when you try loading modules on specific arguments.

Monday 1 June, 2009

How to Telnet to a Web Server - HTTP Requests through Telnet

Interesting, today I came to know there is a way through telnet to get the requests from the server.

Normally we don't see what sent between the web server and the client. Here is the way we can see what's actually received through the telnet.

To connect to the web server - open a command line and type the command
telnet host port

telnet localhost
8080

Then you'll get connected to the particular web server and then you can enter any HTTP command you want such as GET, HEAD.

If you need to request for a web page from the web server you can type the HTTP request as follows.

GET pageName HTTP/1.0
HEAD pageName HTTP/1.0

Hit enter twice. Then you will get a response.


You'll get a 404 status if page not found, 301 if the page is moved permanently and 401 if you are not authorized to access the page. More HTTP status codes can be found here.