twitter
    Find out what I'm doing, Follow Me :)

Tuesday, May 11, 2010

dump mysql database and sync with DR

1.Create crontab script and name it as sync.sh
    mysqldump --no-create-info -h CMS-AUTH01 -uroot -pezidentity eziden > sync.sql
    echo "Sync data retrieved..."
    mysql -uroot -pezidentity -e "drop database eziden;"
    mysql -uroot -pezidentity -e "create database eziden;"
    echo "Database initialized for sync..."
    mysql -uroot -pezidentity eziden < /usr/ezidentity/scripts/cron/tables.sql
    echo "Database sync in progress..."
    mysql -uroot -pezidentity eziden < /usr/ezidentity/scripts/cron/sync.sql
    echo "Database sync completed."

    2. dump mysql database using below command. This command will dump tables structure only without dumping data.

    mysqldump -d -uroot -pezidentity eziden > eziden.sql

    3.add cron jab using below command

    $ crontab -e

    Note: point to above script (sync.sh)


    00 3 * * * bash /usr/ezidentity/scripts/cron/sync.sh

    Thursday, April 8, 2010

    CVS and cvsWEB

     
    CVS how to
    ------------------------------
    OS: CENTOS
    1. install xinetd server using
    # yum install xinetd
    2. install cvs
    # yum install cvs
    3.vim /etc/xinetd.d/cvs
    ------------------------------------------------------------------
    service cvspserver
    {
            disable                 = no
            port                    = 2401
            socket_type             = stream
            protocol                = tcp
            wait                    = no
            user                    = root
            passenv                 = PATH
            server                  = /usr/bin/cvs
            env                     = HOME=/var/cvs
            server_args             = -f --allow-root=/var/cvs pserver
    #       bind                    = 127.0.0.1
    }
    ------------------------------------------------------------------
    Note: by default this cvs service is disabled. you need to enable it by change "no"

    4.initialized repository according to the path you want using below command
    # cvs -d /var/cvs/ init
    5.start xinedd server
    #/etc/init.d/xinetd start
    6.test cvs server is running using following command
    # netstat -tap | grep cvs
    tcp        0      0 *:cvspserver                *:*                         LISTEN      13496/xinetd
     
    7.Cvs allows the user to add user independently of the underlying OS intallation.. Im going to add user for cvs using OS level
    # useradd -G cvs cvs
     
    8.create file name random.pl and put in below code on it
    ---------------------------------------------------------------
    #!/usr/bin/perl
    srand (time());
    my $randletter = "(int (rand
    (26)) + (int (rand (1) + .5)
    % 2 ? 65 : 97))";
    my $salt = sprintf ("%c%c",eval $randletter, eval $randletter);
    my $plaintext = shift;
    my $crypttext = crypt ($plaintext, $salt);
    print "${crypttext}\n";
    --------------------------------------------------------------- 
    use above random.pl to create cvs user password. To create encrypted password run below command
    #./random.pl cvsadmin
    copy and paste this password into passwd file in /var/cvs/CVSROOT/passwd

    9.Create a text file in /usr/local/cvsroot/CVSROOT called passwd and enter the users as shown below (format is: userid:encrypted-password:cvs )
    username1:x$5itFdsw123:cvs
    username2:3fgRH4p3443:cvs

    10.change owner and group of cvs repository and file to cvs
    # chown -R cvs.cvs /var/cvs/

    11.Set restrictive permissions on the file:
    # chmod 400 /var/cvs/CVSROOT/passwd