Tikejhya: Ashish Nepal


Month: March 2012 (Page 1 of 3)

REDMINE: Disabling User Account

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

REDMINE: Disabling User Account (Disable Login) from mysql

mysql -u user.name -pPASSWORD --database redmine -h redmine.ashishnepal.com --port 3306 -ss -e "update redmine.users set status='3' where mail='$username@ashishnepal.com

Script to Remote Login

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.



function chkInput
         if [ -z "$1" ];then
                 exit 0;


function displayUsage
         echo "Usage $0 "

chkInput $1


How to create Key file (password-less login)
Password Less Login A-B B-A

Mysql Dump/ Restore

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

How to dump mysql (one table) from one Server, to another server.

Here i will use Database as database and Table as table to dump
And, restore into Database, table name is not necessary to pass (infact should not pass), as dump has all required information.


`rm -f /tmp/dumpedtable.sql`

mysqldump -u ashish.nepal -pMy_PASS Database Table -h xxx.ashishnepal.com > /tmp/dumpedtable.sql; sleep 30; mysql -uashish.nepal -pMy_thisPass Database -h yyy.ashishnepal.com < /tmp/dumpedtable.sql;

I am deleting, the sql if exists
Mysql dump from server one, xxx.ashishnepal.com
and restore to yyy.ashishnepal.com


Simple mysql dump

Backup only one table.

mysqldump -u -p mydatabase table1 > table1.sql

To restore the backup you can use the following command:

mysql -u -p mydatabase < table1.sql

Share Git Repository with HTTPS

Configuring Apache HTTPS In order to share your repository
Share GIT Repository with HTTPS.

# git.ashishnepal.net

        ServerAdmin admin@ashishnepal.com
        ServerName git.ashishnepal.net

        DocumentRoot /var/version_control/git_repository
        DAVLockDB /var/version_control/git_repository/DAVLockDB
        ErrorLog /var/logs/www/git/ssl_error_log
        CustomLog /var/logs/www/git/ssl_access_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

        SSLEngine On
        SSLProtocol -ALL +SSLv3 +TLSv1
        SSLCertificateFile /etc/httpd/conf/certs/wildcard.ashishnepal.net.crt
        SSLCertificateKeyFile /etc/httpd/conf/certs/wildcard.ashishnepal.net.key.nopass
        SSLCertificateChainFile /etc/httpd/conf/certs/gd_bundle-2011.crt
        SetEnvIf User-Agent ".*MSIE.*" 
                nokeepalive ssl-unclean-shutdown 
                downgrade-1.0 force-response-1.0

                DAV on
                Options ExecCGI FollowSymLinks Indexes
                # Deny everyything here
                AuthType Basic
                AuthName "git repository"
                AuthUserFile /var/version_control/git_repository/git_access
                AuthGroupFile /var/version_control/git_repository/htgroup.git

        Allow from all
        Order allow,deny
                Require group project-read
                Require group project-write

How-to-Install-git with https support on centos

Installing GIT with HTTPS in Centos

Install git with Yum

yum install git-core
cd /path/to/repo
mkdir newProject
cd newProject

git --bare init

chown -R apache:apache /path/to/repo
cd /path/torepo/newProject/hooks
mv /path/torepo/newProject/hooks/post-update.sample /path/torepo/newProject/hooks/post-update
Enable the post-update hook: chmod +x /path/torepo/newProject/hooks/post-update

cd /path/to/repo/newProject
git update-server-info

Now you must ensure Your permision i would again run

chown -R apache:apache /path/to/repo

Otherwise you would get error such as, curl=22 HTTP 401, 403,
this could also be due to permission issue ensure, Ur username and password,

Last but the most importantly see your log file which always provides best information.

Log: Apache log for git.

How to configure Apache config file.

How to MOVE/COPY Users SharedFolder (Windows SBS Server 2008)

How to MOVE/COPY Windows SBS Server 2008 Shared User Folder
How to manually move shared folders
how to migrate users profile from one drive to another.

Firstly: First Lock shared folder.




Copy directory recursively (/E)
copy all file information (/COPYALL)
/COPY:DATSOU, D=Data, A=Attributes, T=Timestamps, S=Security=NTFS ACLs, O=Owner info, U=aUditing info)
do not retry locked files (/R:0)
(the number of retries on failed copies default value is 1 million)
preserve original directories’ Timestamps (/DCOPY:T)

This will definately work “saying” to Copy folder/files, timestamp, permisions and all. However, it is not yet tested if all of roaming profile will be working or not.

(You can find detailed Ref: http://technet.microsoft.com/en-us/library/cc733145%28WS.10%29.aspx)
And (http://technet.microsoft.com/en-us/library/cc875789%28v=ws.10%29.aspx)

Mysql Slave “Skip Error”

(Insert this value in my.cnf)

slave-skip-errors = 1062,1050,1060

Error Code explained.
Message: Duplicate column name ‘%s’

Error: 1062 SQLSTATE: 23000 (ER_DUP_ENTRY)
Message: Duplicate entry ‘%s’ for key %d

Message: Table ‘%s’ already exists

More error code can be found here (http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html)

using atop

using atop

Download atop from http://www.atoptool.nl/

You can download rpm and run
rpm -ivh atop.x86_64.rpm

This tool is simillar to top but also provides history, unlike top which only provides current stat.

visit man atop and man atopsar to explore further.

Count number of mail sent out Each Hour

count the number of maillog for certain hour and sum total

tail -5000 /var/log/maillog | awk '{print $3}' | grep -E "11:[0-9]" | sort -n | uniq -c | sort -n | awk '{print $1}' | awk '{ sum+=$1} END {print sum}'

Debugging logrotate

How to debug logrotate?

logrotate -dv /etc/logrotate.conf

Page 1 of 3

Powered by WordPress & Theme by Anders Norén