Thursday, 28 February 2013

NGINX: SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause

If you are facing below error in Nginx!

SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause
Installing WHM interface...
deploying booster rockets
Traceback (most recent call last):
File "/usr/local/src/publicnginx/nginxinstaller2", line 9, in ?
import createvhosts
File "/usr/local/src/publicnginx/createvhosts.py", line 2, in ?
import yaml
File "/usr/lib/python2.4/site-packages/PyYAML-3.10-py2.4-linux-i686.egg/yaml/__init__.py", line 26
SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause

This error normally happen if you install first time, You have not needed this fix is you are upgrading from old version.
NOTE: Please don't run this fix multiple time

# tar xf nginxadmin.tar

# cd publicnginx

## ./pythonfix

After that you can run installer as per bellow,

# ./nginxinstaller install


It should FIXED now!!!


Please check: http://nginxcp.com/forums/Thread-python-error-issue-fix

Sunday, 24 February 2013

How repair ALL database tables:

Here the command for repair, alalyze or optimze all database talbes in server.


# mysqlcheck -u root -p --auto-repair --check --optimize --all-databases

Below commands are also do the same without mysql root password:

For Repair:

# mysqlcheck --all-databases -r

For Analyze:

# mysqlcheck --all-databases -a

For optimize:

# mysqlcheck --all-databases -o

cheers!!!

Tuesday, 12 February 2013

Why BIND / NAMED service in Chroot?

You know, Why bind in Chroot?

  
  • The idea behind chroot is fairly simple. When you run BIND (or any other process) in a chroot jail, the process is simply unable to see any part of the filesystem outside the jail. For example, in this document, we'll set BIND up to run chrooted to the directory /chroot/named. Well, to BIND, the contents of this directory will appear to be /, the root directory. Nothing outside this directory will be accessible to it. You've probably encounted a chroot jail before, if you've ever ftped into a public system.
  • The idea behind running BIND in a chroot jail is to limit the amount of access any malicious individual could gain by exploiting vulnerabilities in BIND. It is for the same reason that we run BIND as a non-root user. 
Note:
The domain name service provided by BIND (named) software. It uses both UDP and TCP protocol and listen on port 53. DNS queries less than 512 bytes are transferred using UDP protocol and large queries are handled by TCP protocol such as zone transfer.                                                                  

    Sunday, 10 February 2013

    rsync VS scp

    There are two main differences between rsync and scp. 

     

    • Before a file is transferred rsync takes the checksums of the file 
    (MD5 and adler-32 I believe) and sends them to the receiver. 
    After a file is transferred the receiver verifies
    the data integrity using those checksums. 
    
    
    
    
     
    scp does not have such mechanism. scp uses ssh to transfer the data and although
    ssh uses checksums on the packet level that's a different story 

    • Another difference is what happens during a transfer retry,
    
    
    While scp will ignore any partially transferred set of files and
    overwrite them on the receiving end,
    
    
    
    
     
    but rsync is more clever than that. Rsync will check the destination for any
    files present and if their signature matches that of the files on the
    sender side it will not retransmit these files.
    It might be possible to overwrite this behavior.

    Friday, 1 February 2013

    Current Working DATABASE!


    To konw current working database in mysql:

     

    Generally, The mysql Working environment like below,

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | ranjith_test       |
    | test               |
    +--------------------+
    4 rows in set (0.14 sec)

    mysql> use ranjith_test;
    Database changed
    mysql>

    Add the following sector in my.cnf file to konw current working DB name

    [mysql]

    prompt=`mysql(\d)>`


    Then restart the mysql service.

    [root@ranjith ~]# /etc/init.d/mysqld restart
    Stopping MySQL:                                            [  OK  ]
    Starting MySQL:                                            [  OK  ]
    [root@ranjith ~]#

    Here, the mysql(\d) within symbol "`" is nothing but a back-ticket.


    After adding the above sector in my.cnf file, Yoru mysql environment start showing the current database name which you are working with,

    `mysql((none))>`show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | ranjith_test       |
    | test               |
    +--------------------+
    4 rows in set (0.01 sec)

    `mysql((none))>`use ranjith_test;
    Database changed
    `mysql(ranjith_test)>`
    `mysql(ranjith_test)>`
    `mysql(ranjith_test)>`use test;
    Database changed
    `mysql(test)>`
    `mysql(test)>`
    `mysql(test)>`exit
    Bye