Monday, September 24, 2012


Configure NFS server:
 
   Set up NFS server linux machine:
   
    NFS server machine ip address is 10.1.10.100
 we have to configure /etc/export entry as follows in NFS server machine:

root@sundar:~# cat /etc/exports | grep "/u"
/u       10.1.10.20(rw,sync,no_subtree_check)


NFS client machine [10.1.10.20] can access the NFS server's u folder with read write access:

/u       10.1.10.20(rw,sync,no_subtree_check)

   

To mount NFS in NFS client:

root@sundar:~# mount -v -t nfs 10.1.19.100:/u /mnt
mount.nfs: timeout set for Mon Sep 24 12:37:05 2012
mount.nfs: text-based options: 'addr=10.1.10.100'
10.1.10.100:/u on /mnt type nfs (rw)
++++++++++++++
 afterwards copy using
cp /mnt/file destPath

Current /etc/export entry:

+++++++++++
root@sundar:~# cat /etc/exports | grep "/u"
/u       10.1.10.20(rw,sync,no_subtree_check)
+++++++++++



In Embedded linux device, How to copy files ? Thru teraterm or NFS or via USB cable or via USB storage.
we can mount the storage, copy the files from USB and copy it to device

Create mount point:

i)Insert USB storage
ii)cd mnt
iii)cd usb [or any folder]
iv) fdisk -l - fdisk commandline tool is managing hard disk/usb partitions in linux
fdisk -l
  list all the partitions
   /dev/sda
   /dev/sda5
v) mount /dev/sda5 /mnt/usb
vi) cp /mnt/usb/file . #Do operations...
vii)umount /mnt/usb #unmount the USB


In linux, How to sort the files by modified date?
I want to list the recently modified files should be listed in top.
The files which is not accessed for long time should be listed in bottom.
Can we write script ? No Need:

we can simply use "ls" command advanced version.

we have to use below command to list the files by recently modified date order.

ls -ult

Wednesday, September 19, 2012


How to run program in server even though our login session is over?

Usually  most people run android source code building from server via putty.
whenever we are giving build or any commands, it will not be executed once the putty session is over.

To avoid this, Linux has one most powerful command. That is screen.

we can use this screen command for various purposes.

screen syntax:
screen commandToBeExecuted


One more beauty of screen command is we can run our application and command in server, we can close the putty session. when we are reopening the putty session,
we can reattach that screen command & get results in ur putty.

For example while building I am getting some errors. One of my colleague is very well known how to resolve that error.Then I will go to his place and give "screen make" command(make is to build android code) while getting errors I will ask him to resolve it. when error is resolved, I can do "screen make" from his system. After this we will get build logs in his system.Not to disturb my colleague's work, I can detach the session from server, But still compilation will be done in background.I can go back to my seat and reattach the session, now the build process logs will be shown in my system.

To summarize:

From my friend's system I will do the following:

To build android code in server, I will give

screen make and will press ctrl+a and d then screen will print some id

  detached from 2309_pts-2

From my system, I will do the following:
  1) will open new putty session
  2) type "screen -r 2309_pts-2" [reattach the session]

Now the build logs will be shown in my system.


This screen command can be used for
  1) building the code even though the client session is over
  2) any background tasks activities can be done through it
  3) any big file downloads/android source code downloads can be done through it
     [In google chrome, there is an option called downloading the file in background even though the browser session is over]
4) To download android source code in background, i will do "screen repo sync", it will download the code in screen session


To list all the screen commands running in a server/system, we can use "screen -ls" command to list all the screen sessions running.