Subscribe:

Ads 468x60px

Pages

Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

Friday, July 15, 2011

Running program when terminal closed?

Question: I started the process and move a process to background by using bg command or Ctrl+z or ampersand symbol (&) from the terminal. But when I am closed the terminal that also terminates the background process. How to I ensure that the background processes is not terminated even after i close the terminal?

Solution: 
Most of the time you running process in background in the terminal via bg or Ctrl+z or ampersand symbol (&). If you start a command and you closed the terminal, the process / command will get killed. This is because Linux Operating System, by default will end the process if you exit your terminal. Sometime the  job or command takes a long time ,  it is not secure to let your terminal open while you are not there, or maybe not possible to let it open if you are over a running process in background, so you may want to use nohup command to let the process running even when you exit your terminal. If you are not sure when the job will finish, then it is better to leave job running in background. However, if you logout the system, the job will be stopped. What do you do? For this use any one of the command to run process in background even if you exit from terminal or logout from your session.
1.     use the “screen” command
2.     use the  “nohup” command
3.     use the “disown” command

1. The “screen” utility: Just open a shell terminal and type screen  -ls . You get the name(s) of the screen session-terminal(s)  where a process was set to be run in back-ground (bg) . Now use “screen -R session-terminal name ” and BINGO , you can manipulate the process if it is still running (not finished his job).

2. The “nohup” utility is an  ” out of the box” utility , just run any command but in front set the keyword “nohup“  example :  nohup  cat /dev/zero > /dev/null  &
Be sure to add the & sign so the command is executed in background. Now even if  the terminal is closed , the process / command will continue to run . Just open a new terminal and run :
ps -aux |grep nameof-command (ps aux |grep cat ) and BINGO you get the PID of the process.

3. The “disown” command has the same functionality but is implemented differently .
Just enable a process to run in the background with the &  . The terminal will assign a job-ID to this process , let’s say 5065 . Now use disown 5065 , and the process will be inherited by the init process , so even if the terminal is closed the process will keep running.

How does disown and nohup commands work? 
What they do is that they connect all your process to the parent process of the computer which happens to be init (the parent process of all process running on the computer). Viewing all the process on the computer, use pstree command , the init is first (root of the inverted tree) process which radiates all the other process in the computer. Now if you run the top command you will see all the processes that were manipulated with disown and nohup with a PPID of 1 (init) .

Please feel free to comment to make it more useful to everyone.

Read more...

Thursday, July 7, 2011

Interview Questions - Part II


1. Booting procedure of linux?
2. What is initrd image?
3. what is the last file executed during the boot process.
4. How to restrict login to a server for maintanence
6. What is NIS. What are the configuration files both server and client
7. NIS database format?
8. What all can be shared using NIS.
9. What is consept of NIS mater and slave.
10. WHich all way an NIS slave server get the database get updated?
11. Daemons/services used for NIS.
12. Whatis NFS.What are the configuration files?
13. How to enable client side root access to NFS shares?
14. Daemons/Services required for NFS.
15. Ports used by portmap.
16. port used by NFS.
17. If you accidently removed the password file how can you restore it. (Not)
18. If the system is not booting after grub is loded . How you are going troubleshoot?
19. What all the resource records of DNS?
20 what is the port used by DNS
21 What is primary and secondary DNS server?
22. Is it possible to register the DNS server only with primary DNS server
23. What is the client side configuration file for DNS
24. What is maxium number of DNS server entries at client side.
25. What is automount?
26. what all the daemons required for automount
27. what is the purpose of using automount.
28. How do you change the kernal parameters.
28. how to see the current kernal parameters.
29. How to make the modules automaticall y loded on boot.
30. What are the different types of kernals in linux.
31. Kernal comilation procedure.
32. How mail works in general.
29. What is the port for SMTP.
30. What is the pot for POP3
31. What is IMAP?
32. what is MTA.
33. wHAT IS ssh?
34. How ssh is secured.
35. Is it possible to have passwordless login usign SSH.
36. What is the difference between telnet and ssh.
37. What is the difference between xinetd and init.d services?
38. What is the core process in linux OS?
39. What is difference between hardlink and soft link in linux.
40. What is umask and what is the default umask for root user and normal user.
41. Where can be set the system wide environment variables?
42. Where can be set the user level environment variables.
43. If we need to execute a script when ever a user login where to place that script ?
44. How to load a module in to the running kernal
45. How to unload a module from the running kernal.
46. How to compile new modules in to a kernal.
47. how to list the listening ports on a linux ox
48. How to list only a particular user process.
49. How to list all the processes ina linux box.
50. How to list all the iopen files in a linux box.
52. What is cpio?
53. how to list the most space used files and directories.
54. How to delete all the files older than 10 days from a directory tree
55. What all the different fields of a crontab file.
56. NFS options
57. How to boot in to single user mode.
58. What are the difference run levels in linux.
59. where is the default runlevel is mentioned?
60. If yousee the memory usage os 100% what all the step you will take to make the server stable. Reboot is not possible.
61. Is it possible to reduce the size of a logical volume.?
61 how to increase the size of a logical volume/volumegroup.
63. What are the differenttype of the devices in linux.
64. How to create raw devices in linix.
65. If you see a log files is grown up to some GB and you want to free up some space. You are not supposed to stop the application. How do you do it?
66. What are the different kill signlas.
67. What kill -HUP does?
68. What is the default port for apache?. How to change the default port?
69. What are the different types of virtual servers in apache. and difference.
70. What it the reverse proxy in apache?. and where it can be useful.?
71. Are you familer with module in apache?
72. What is the use of rewringing modules.
73. what is the ports for http?. Is it possible to use another port?.
74. If we use another port for http how it can be accesed from a web browser with out putting the port in the URL.
75. How to see the speed of a NIC?
76. What is duplex of NIC? and what is difference between half duples and full duplex?
77. How to change the duplex settings of an NIC?
78. What you mean by auto negotiation of an NIC?.
79. How to see the performance of of a linux box?
80. How to see the disk performance of a linux box?.
81. How to see the network traffic on a linux box?.
82. What is SNMP?.
83. Ports used by SNMP?.
84. How to see the file system usage?.
85. What happened if /tmp is full on a mail server?.
86. what happened of /var is full on a mail server?.
87. If you have 100 systems to install. How you are going to do it?.
88. What you mean by TCP wrapper. What all the files used in this?
89. If you find your system is targeted for a bruteforce attack how you are going to prevent it?
90. WHat is GFS?
91. What is the latest version of GFS?
92. What is the difference between gfs and gfs2.
93. Command for creating GFS files syste, gfs_mkfs(gfs.mkfs for gfs2) -p lock_dlm(gulm) -t clusterName:FSname -j Number of Journal
94. For a 5 node cluster the the number of journal required for a GFs?
95. List the cluster specific Daemons.
96. What is ccsd ?
97. What is CMAN?.
98. What is the service required for GFS+LVM?
99. What is fenced
100. How do you see the status of cluster services.
101. How do you manage cluster services (relocationg and starting and stoping)
102. Steps to create a cluster services.(HTTPD)
104. Does the GFS files system required to be put it in /etv/fstab? Why?.
105. What is OOM?.
106. What is the immediate fix for the OOMM killing process?
107. What is the permanent fix for OOM killing process?.
108. The most destructive commands in linux?.
109. How do you make root mails to forward to your email address [Update /etc/alaises with mail address root: email]
110. How to update /etc/aliases



Please feel free to comment to make it more useful to everyone.
Read more...

Saturday, July 2, 2011

Interview Questions - Part I


Harvest company interview question:
-----------------------------------


Mysql server
------------
1.what is the switch, router and hub?
2.who was owned by the ubuntu os?
3.how to share file through nfs?
4.why need of samba? what is the service name used of samba and config file of samba?
5.how to take a backup and restore the mysql server?
6.what is a port no for ftp, mysql and https
7.Do you have any idea on clouding?


Apache:
-------
1.What is virtualhost in apache?
2.what is ip based and namebase website
3.what are types of log files present in the apache and what r there?
4.can i create websites with multiple ports?
5.where u will mention the logs in config file?
6.what is the difference b/w the access and custom logs
7.where thes log files present?
8.what is are the log files present in the apache
9.How many virtualhost can we assign
10.what is 500 error? why it will get?
11.what is 404 error? why it will get?
12.what is rewrite?


LAMP:
-----
1.What is a LAMP suite?
2.I am setting up LAMP successfully.
  a.But when i browsing i am getting blanks page why?
  b.when i browsing the site. i can see the list of directories. when i click them it will be downloaded. but the directories should not be downloaded. then what u will do?(i dont not actually directories or files)
  c.I have index.php page. when the client visit to index page it should show index.html not index.php. wat u will do for this?
  (i said by doing alias we can do this. then interviewer questioned me. if i have multiple pages with .php extention then pages should be visible in html extension.)

Read more...