21.4.09

Windows 7 RC coming to MSDN/Technet soon, public May 5

The Windows 7 RC will be publically released on May 5, and should be available for MSDN and Technet subscribers now.

Full article


share on: facebook

20.4.09

Change user and password for service by VBS

For changing passwords for services across domain

First step:
Create the vbs script change.vbs

-----------------------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("list.txt", ForReading)

Const ForReading = 1

Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close

For Each strLine in arrFileLines
MyArray = Split(strLine, "|", -1, 1)

strComputer = trim(MyArray(0))
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where DisplayName = '" & trim(MyArray(1)) & "'",,48)
For each objService in colItems
errServiceChange = objService.Change( , , , , , ,trim(MyArray(2)),trim(MyArray(3)))
'wscript.echo(errServiceChange)
objService.StopService()
wscript.sleep 20000
objService.StartService()
Next

Next
wscript.echo "Done"
-----------------------------------------------------------------------

If you don't want to restart service after changing password just remove next rows from script

objService.StopService()
wscript.sleep 20000
objService.StartService()


Second step:
Create text file list.txt consist of Server name, Service DisplayName, username in format domain\user, password divided by pipe (|)

-----------------------------------------------------------------------

Server1|SQLSERVERAGENT|DOMAIN.NET\user|password
Server1|MSSQLSERVER|DOMAIN.NET\user|password
Server2|Messenger|DOMAIN.NET\user|password
Server2|HTTP SSL|DOMAIN.NET\user|password
Server3|Computer Browser|DOMAIN.NET\user|password
-----------------------------------------------------------------------
share on: facebook

Oracle to buy Sun

SANTA CLARA, Calif., April 20, 2009 -- Sun Microsystems (NASDAQ: JAVA) and Oracle Corporation (NASDAQ: ORCL) announced today they have entered into a definitive agreement under which Oracle will acquire Sun common stock for $9.50 per share in cash. The transaction is valued at approximately $7.4 billion, or $5.6 billion net of Sun's cash and debt.

http://www.sun.com/third-party/global/oracle/
share on: facebook

Replace vi with nano or pico

In most of linux/unix OS default text editor is vi.
If you can't remember all vi switches, you don't have to.
Just replace you default editor vi with user friendly nano or pico

First figure out the path to the binary file {path}

#which pico
or
#which nano

Second change your EDITOR variable

#export EDITOR={path}/pico
or
#export EDITOR={path}/pico

If you want make this change permanent, just add previews rows to ~/.bashrc if you use bash or ~/.cshrc if you use csh etc...



share on: facebook

19.4.09

MySQL bi-directional table replication

MySQL bi-directional table replication

On first server with ip address 10.10.10.1

/etc/my.cnf
server-id=1
master-host=10.10.10.2
master-user=slave_user
master-password=password
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 1
log-bin=/var/lib/mysql/mysql-bin.log
log-bin-index=/var/lib/mysql/mysql-bin.index
log-slave-updates
replicate-do-db=db_name
binlog-do-db=db_name
relay-log = /var/lib/mysql/relay-bin
relay-log-index = /var/lib/mysql/relay-bin.index
relay-log-info-file = /var/lib/mysql/relay-bin.info

/etc/init.d/mysqld restart

mysql>GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
mysql>FLUSH PRIVILEGES;
mysql> SHOW MASTER STATUS;
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS\G


On first server with ip address 10.10.10.2

/etc/my.cnf
server-id=2
master-host=10.10.10.1
master-user=slave_user
master-password=password
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 2
log-bin=/var/lib/mysql/mysql-bin.log
log-bin-index=/var/lib/mysql/mysql-bin.index
log-slave-updates
replicate-do-db=db_name
binlog-do-db=db_name
relay-log = /var/lib/mysql/relay-bin
relay-log-index = /var/lib/mysql/relay-bin.index
relay-log-info-file = /var/lib/mysql/relay-bin.info

/etc/init.d/mysqld restart

mysql>GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
mysql>FLUSH PRIVILEGES;
mysql> SHOW MASTER STATUS;
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS\G


Default path for bin logs /var/run/mysql is cleaned every restart.

For an emergency
reset slave;
share on: facebook

Ucarp. Virtual IP for Linux boxes

UCARP allows a couple of hosts to share common virtual IP addresses in order to provide automatic failover. UCARP is a portable implementation of the CARP protocol.

#Start script for first host

/usr/sbin/ucarp -B -z -P -b 1 --interface=eth0 --srcip=10.10.10.1 --vhid=1 --pass=zxcvbn --addr=10.10.10.10 --upscript=/etc/vip-up.sh --downscript=/etc/vip-down.sh

#Start script for second host

/usr/sbin/ucarp -z -B -b 2 -k 200 -r 4 --interface=eth0 --srcip=10.10.10.2--vhid=1 --pass=zxcvbn --addr=10.10.10.10 --upscript=/etc/vip-up.sh --downscript=/etc/vip-down.sh

-------------------------------------
Startup script /etc/vip-up.sh

#!/bin/bash
/sbin/ifconfig eth0:1 10.10.10.10/24 > /dev/null 2>&1

-------------------------------------
Shutdown script /etc/vip-down.sh

#!/bin/bash
/sbin/ifconfig eth0:1 down > /dev/null 2>&1

Make scripts executable

chmod 700 /etc/vip-up.sh
chmod 700 /etc/vip-down.sh
share on: facebook

Squid NTLM auth and Java Browser

Java Browser (Java Browser starts inside you regular browser window and shows Java applet) doesn't work properly with Squid NTLM auth. If you want to enable Java applets, add few rows to Squid proxy server config file (RedHat family) /etc/squid/squid.conf

#Add access control list
acl Java browser Java/1.4 Java/1.5 Java/1.6

#Add rule
http_access allow Java

Important add the rule before rule "http_access allow DOMAIN"
share on: facebook