Archive for category Tools

cwrsync 4.0.4 to UNC Paths

Posted by on Thursday, 15 July, 2010

It seams to me that handling of UNC paths changed since the last version i used. After some pain i am now able to sync from europe to china again. Here are some hints for other poor souls that may prove helpfull:

* If you are using rsync on windows to sync to an UNC Path (\\server\some\path) on the receiving end – be sure to run the service as an account that can access the share. In my case a domain user was needed, the local service account  (svccwrsync) failed of course

* UNC Paths worked previously like this (in rsyncd.donf):
path    = \\fshsmsxxx\d$\Public Share\Engineering\somePath

Not any longer. Now with rsync 3.07 its
path    = //fshsmsxx/d$/Public Share/
Engineering/somePath

rsync on windows chown failed: Invalid argument (22)

Posted by on Monday, 12 July, 2010

Using cwrsync 4.04 a lot of  “chown failed: Invalid argument (22)” showed up.

After some research the following tricks removed those annoying erros:

In rsyncd.conf set user and group to :
uid = 0
gid = 0

in the rsync call, replace -a (which is short for -rlptgoD (recursive, copy symlinks, preserve permissions, preserve modification times,  preserve group,  preserve owner , preserve device files,preserve special files  ) )
with -rt (recursive, preserve times)

Now using
rsync –super –recursive –delete –compress –times testSource CWsync@targetServer::testDestination

see http://www.itefix.no/i2/node/12340 for details

Remotly killing a RDP Session

Posted by on Wednesday, 2 June, 2010

Server full, or a session handing .. you know it’s a pain. But how to remotly get you a free session?

First check the sessions

qwinsta /server:<servername>

SITZUNGSNAME   BENUTZERNAME      KENNUNG STATUS  TYP         GERÄT
console                        0                                     Verbunden                                    wdcon
rdp-tcp                     65536                              Bereit                                               rdpwd
rdp-tcp#5               xxchr95                         2                                      Aktiv       rdpwd
rdp-tcp#13            xxkla19                           1                                     Aktiv        rdpwd

Then, kick a sesson

rwinsta 2 /server:<servername>

Where 2 is the Session Id from the qwinsta command

Or, if you happen to be admin on the target machine take over the console RDP session

mstsc /console /v:<server>

Find out what mysql queries are slow

Posted by on Wednesday, 2 June, 2010

So you are using mysql and have some data in your DB … say 2 million rows or something.  Not it’s about time to see how your SQL queries are doing, do some profiling, but … but how to you find out what sql queries are slow? Where you are missing that index? Try the following in your mysql.ini

[mysqld]
#enable slow query logs
log-slow-queries = d:/your/path/to/log/slow.log
# default of “slow” is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)
log-queries-not-using-indexes


Then you see where you’re not using the index, where you forgot it. Maybe use EXPLAIN on some of your longer queries to find out how to improve them

[mysqld] 
#enable slow query logs
log-slow-queries = d:/phpapps/xampp/mysql/log/slow.log
# default of "slow" is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)
log-queries-not-using-indexes

VBS Database connection to MySQL usting ODBC

Posted by on Thursday, 15 April, 2010

Damn, this feels dirty …


Sub LogDateiInMSql(query)
db_server = "localhost"
db_user = "root"
db_pass = ""
db_name = "eparcel"

' init connection to MySQL
Set conn=CreateObject("ADODB.Connection")

' you need the odbc driver installed, obviously
strConnectString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=" & db_server & ";" _
& " DATABASE=" & db_name & ";" & "UID=" & db_user & ";PWD=" & db_pass & "; OPTION=3"

conn.Open strConnectString

If conn.State = 1 Then
MsgBox "connected"
Else
MsgBox "connection failed"
End If
Set rs=CreateObject("ADODB.recordset")

Set rs = conn.Execute(Sql)
Do While not rs.EOF
MsgBox rs(0)
rs.MoveNext
Loop

conn.Close
End Sub

LogDateiInMSql("show tables")

mysqldump on other host – an example

Posted by on Monday, 15 March, 2010

Just so i do not forget it:

mysqldump -hservername –user=backupuser –password=backupuserpassword –verbose databasename > backupfile.dmp

notes:
-h<servername> has no space between the -h flag and the hostname. No idea how they came to that idea.
<backupuser> has to has loginrights from any host or from your host table (the usual local user will not work)
<backupuser> needs LOCK TABLE permission for that DB
–verbose makes your live much easier

Importing a SVN dump it a new repository

Posted by on Wednesday, 13 January, 2010

Do the dumping on the old repository

svnadmin dump /var/oforge/svn/PROJJECT_NAME > DUMPFILE

Importing in the new repository

svnadmin load /data1/svnroot/grz_yy_test/ < DUMPFILE

Note that the whole structure in imported/exported, so mind existing /trunk directories

Using wget with proxy on windows

Posted by on Wednesday, 7 October, 2009
If the enviroment variable http_proxy is set wget will automaticly use it

set http_proxy=http://12.34.56.78
wget -proxy on http://iserver09.example.com/
set http_proxy=

Using rsync with proxy on windows

Posted by on Tuesday, 6 October, 2009

If you need to use rsync with a proxy:

set enviroent variable RSYNC_PROXY, if this is set rsync automaticly uses this proxy on port 873

set RSYNC_PROXY=12.34.56.78:80
rsync -auv –delete –stats  /cygdrive/c/source/directory username@hostname::rsync_share
set RSYNC_PROXY=

If you are using an apache as proxy your config should be looking a bit like this

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so

<IfModule mod_proxy.c>
AllowCONNECT 873
</IfModule>

Remove Adobe Acrobat using Windows Installer Cleanup Utility

Posted by on Tuesday, 4 August, 2009

I had Adobe Acrobat on my system and tried to upgrade. Adobe Installer complained some .msi file could not be found, so uninstalling or upgrading would not work. Nice work Adobe. For what do i need the installer when I got the new version at hand?

After some trying, swearing and googeling I came across the WINDOWS INSTALLER CLEANUP UTILITY. Yes, Microsoft has a tool for screwed up Installers. Better yet, it works fine. Nuked Acrobat from my system.

Will not touch it again, using Foxit Reader now. Displays PDFs, is fast, works.