Wednesday, September 11, 2013

svn+ssh upadates(up) and co without password

In many cases people want to automate(scripting) the process for updating/checkout the source code from svn+ssh. For svn+ssh we require to enter password to interactive prompt. To avoid the pass interactive shell and provide password on the command line do following:

If you do not have sshpass installed please install it.

PS: do not export any variable, in the main terminal-shell itself. Export them into the script as exporting it in the main terminal shell may not ask you password at the time of checking in code into repository as well, which certainly nobody wants.

So write a small script 
 line following

#!/bin/bash
cd $local_repo_dir
export SVN_SSH="sshpass -e ssh"
export SSHPASS="ssh_password_to_remote_repository_server"
svn co
svn up


Wednesday, September 4, 2013

finding a screen in which process in running.

If you are working with screen and you have lot of active screens and each one with lot of tabs. If you want to find a screen in which particular process with some pid is running then I could not find any command which does so.  eg:
        What to find screen in which instance of vim is running then there is no inbuilt command to do so.

So Written a small one line complex script for the same.

Just set $CHILD_PID ( or replace the $CHILD_PID) with the pid of process, which is running under screen.

Output will be a line which  shows only  a screen pid (which you could use to log into corrosponding screen)

${ screen -ls | cut -d "." -f  1 | while read PID; do pstree -p $PID | grep "$CHILD_PID" > /dev/null; if [ $? = 0 ]; then echo "$PID" > sam; fi; done } 2>/dev/null; tail sam

After logging into screen you will have to search each and every tab, to find the process.
Process might be running in the backgound so do not forget to do $jobs. 

Thursday, November 22, 2012

building linux kernel outside of source tree

This articles tells you about building the linux kernel outside the linux kernel source directory. Since if we build linux kernel from root directory of the kernel source code, compiled build  and header files are generated in the linux source tree itself. To remain linux kernel source code intact of auto generated files, we are expected to build it outside the tree. It is not very difficult to build it outside the tree. You just have to provide only one flag,
                            O=< obsolute_path_of_the_build_directory >
Here obsolute_path_of_the_build_directory  is the path of directory where you want the all the build and auto generated files. Most of the people forget to provide "O=" flag while generating the .config file. But that is the serious error and you are expected to provide it while building .config file with utilities such as menuconfig, gconfig, xconfig.

So here is a detailed process,

suppose my linux source tree  is in directory /home/rahul/linux_2.32.9
and I want to build kernel in directory /home/rahul/build, then

1> first  $cd /home/rahul/linux_2.32.9

2> /home/rahul/linux_2.32.9$ make O=/home/rahul/build menuconfig

3> /home/rahul/linux_2.32.9$ make O=/home/rahul/build

4> /home/rahul/linux_2.32.9$ make O=/home/rahul/build modules_install

5> /home/rahul/linux_2.32.9$ make O=/home/rahul/build menuconfig install

And as I think you have installed new kernel as of now. Enjoy.

Monday, August 13, 2012

Similarities between lover and developer.

Whike working as  a developer for almost 2 years I have found following facts, after reading you too may feel I am right , you just need to have loved someone !!!

1> You have to give them time and space.
2> You will have to spend something on them so they give you back what you want.
3> Do not talk with them in anger they may get heavy on you.
4> Its hard to get replacement. You cant forget them, cant forget time spent with them.

Developer is a lover, making them unHappy you wont get anything.

Friday, July 27, 2012

Postgresql: create first user and first database createdb createuser

Here I have explained how to create first database and first user for postgresql database. If you are reading article then am sure that you are newbie with postgresql.

As we need some user to create database we will create user first

1> Creating user

To create user we must login to some existing user. The existing user is postgres.
As postgres doesnt have password we must login using root.

so first login in shell as root.

domnique@domniquepc:~$sudo  su

Then from root, login into postgres

root@domniquepc:~#sudo - postgres

now Create  new user here using command createuser,

postgres@domniquepc:~$ createuser domnique


You will be asked if you are a superuser, in my case I had said yes, as I was the only one to access this computer. Do not know other options

2> Create Database

After creating new user it is much simple to create new database, I had used following command which  will set me as a owner of database

domnique@domniquepc:~$ createdb  mingle

Once you create the fist user, then using this user later you could create many databases and new users.