Wednesday 29 December 2010

Windows + Schedule shutdown

I had a scenario where i need to shutdown my windows machine after a particular period of time . I used the windows shutdown command to do this task and it did pretty well.

shutdown -s -f -t 3600

Windows + UN schedule  the shutdown

shutdown -a

 

 

How to set svn:externals

svn:externals is the beautiful option subversion provides to just point another repository content to your repository and it checkouts when your repository is checked out or updated. Due to this you don't  have the same contents in multiple repository occupying the disk space and easy maintenance like don't have to apply your changes to all the repository. Change in one repository and get the changes in all the other repository using svn:externals . Get more details from http://svnbook.red-bean.com/en/1.0/ch07s03.html and below is my svn externals settings,

cat externals.txt

madhu http://localhost/svn/madhu/test

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

svn propset -F  externals.txt .

property 'svn:externals' set on '.'

svn di

Property changes on: .
___________________________________________________________________
Added: svn:externals
+ madhu http://localhost/svn/madhu/test

svn ci -m "set externals"

Sending        .

Committed revision 8.

svn up

Fetching external item into 'madhu'
A    madhu\New Bitmap Image.bmp
Updated external to revision 9.

Updated to revision 8.

C:\repo>svn info

URL: http://localhost/svn/repo

C:\repo\madhu>svn info

URL: http://localhost/svn/madhu/test

svn propget svn:externals

madhu http://localhost/svn/madhu/test

svn propdel svn:externals

property 'svn:externals' deleted from '.'

Thursday 16 December 2010

Hudson Jobs in the subversion repository

Everyday morning the first thing i look after entering the office is Hudson. It doesn't mean i am an expert in hudson, i am still in the learning phase .We decided to bring all the Hudson contents to subversion ,that's the version control tool we use to maintain our source code. Once we move everything in to subversion we no need to worry about losing the data and its easy for maintenace. As our company follow the Agile methodology the continuous integration plays an important role that's where Hudson comes in to picture. So as the first step towards this, we moved the Jobs directory in to the subversion. This task was given to me ,already there was a repository created for committing the Hudson content's .So i decided to use `svn import` as this doesn't need a working copy to be checked out and it also creates the intermediate directory if it doesn't exist in the repository but import don't accept multiple arguments so can't pass all the jobs in a single command and also can't import the whole jobs directory in a single shot as the jobs directory size was more than 20GB and we weren't sure whether subversion can handle such large data ,so decided to write a shell script which will do the import one by one by going through the loop. Below is the shell script which does this work.

cat svn-import.sh

./svn-import.sh password

#! /bin/bash
import_dir=(5.4 5.4.1 6.1 6.0.2)
for i in ${import_dir[@]}
do
echo "processing $i"
for f in $i\*
do
:
for a in $f
do
b=`echo $a| cut -d '/' -f4`
echo `svn import $a/* https://forge.collab.net/svn/repos/hudson/relenghub/jobs/$a/* -m "[artf78984] Adding the $b hudson jobs to subversion for easy maintenance and recovery" --username=madhu --password=$1 --no-auth-cache` &> "/tmp/import.log"
done                                                  done

done

And used the same script to copy the files from one directory to another,

cat copy.sh

./copy.sh


#!/bin/bash
import_dir=(5.4.1 6.1 6.0.2)
for i in ${import_dir[@]}
do
echo "processing $i"
for f in $i\*
do
echo $f
for a in $f
do
/bin/cp -v -r $a/2010-12-1[1,2,3]*   /tmp/jobs/$a/
/bin/cp -v -r $a/builds/2010-12-1[1,2,3]*   /tmp/jobs/$a/builds/
/bin/cp -v -r $a/config.xml   /tmp/jobs/$a/config.xml
done                                                                                                                                                                                                                                               done
done