Friday, August 31, 2012


Background Process, Linux:

  if we want to run the process as background,we have to use & symbol.

   bash>./test.sh to run it as foreground service.

 To run it in background,

   bash>./test.sh &

How to run the process as service in linux: [Always up]:

  1) while linux system is in init process, shell files available in /etc/init.d got executed

whenever the system is up,  .profilerc or .bashrc or /etc/init.d/ scripts are executed.
Add your process to run in background

 add below line in your .bashrc or in any /etc/init.d/*.sh scripts
 
  ./MyService &


In Linux, From command prompt, if I want to do some bulk copy,usually I do like this:

 i) in one command prompt, I will perform copy operation
 ii)In another command prompt, I will do other work

We can do the same thing in single command prompt... How to do it ?

 i) run copy operation in background operation
 ii) Continue your work

  >cp bigFolder folderB &
   it will immediately returns to prompt,since copy operation is performed in background.
Next line, I can do any operation.
  >

 Once the copy operation is done, It will show below message in command prompt:

 2+1 cp Done.

 

Labels: , ,

0 Comments:

Post a Comment

<< Home