57 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			57 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| 
								 | 
							
								--------------------------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								daemons backgrounding,
							 | 
						||
| 
								 | 
							
								Nico Schottelius 2005-06-12 (Last Modified: 2005-06-12)
							 | 
						||
| 
								 | 
							
								--------------------------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								0. Definition
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								A daemon is a program which runs in the background, not having a tty
							 | 
						||
| 
								 | 
							
								associated necesserally. Running in background does not mean it has
							 | 
						||
| 
								 | 
							
								to background (fork()) itself, but that you cannot control it directly
							 | 
						||
| 
								 | 
							
								from a shell.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								1. Daemons and cinit
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Respawning daemons is a bit more difficult, as daemons do often fork()
							 | 
						||
| 
								 | 
							
								(go to background, the calling process exits).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								This way cinit cannot watch it directly.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								The first solution is to check the documentation of your daemon program,
							 | 
						||
| 
								 | 
							
								if it has a switch to disable forking
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								The following daemons / servers are known to avoid backgrounding easily:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								      bind [dns server/caching]:    -f
							 | 
						||
| 
								 | 
							
								      cupsd [printer server]:       -f or -F
							 | 
						||
| 
								 | 
							
								      dhcp3 (isc) [dhcp server]:    -f
							 | 
						||
| 
								 | 
							
								      distccd [compile server]:     normal behaviour
							 | 
						||
| 
								 | 
							
								      frox [ftp proxy]:             "NoDetach" in config
							 | 
						||
| 
								 | 
							
								      mini-lpd [printer server]:    normal behaviour
							 | 
						||
| 
								 | 
							
								      metalog [log server]:         normal behaviour
							 | 
						||
| 
								 | 
							
								      monotone [vcs]:               normal behaviour
							 | 
						||
| 
								 | 
							
								      nessusd ["security server"]:  normal behaviour
							 | 
						||
| 
								 | 
							
								      ntpd [time server]:           -n
							 | 
						||
| 
								 | 
							
								      oops [http proxy]:            normal behaviour
							 | 
						||
| 
								 | 
							
								      openssh [ssh server]:         -D
							 | 
						||
| 
								 | 
							
								      openvpn [vpn server]:         normal behaviour
							 | 
						||
| 
								 | 
							
								      pbbuttonsd [power management]:normal behaviour
							 | 
						||
| 
								 | 
							
								      proftpd [ftp server]:         -n
							 | 
						||
| 
								 | 
							
								      qmail [mta]:                  normal behaviour
							 | 
						||
| 
								 | 
							
								      rsync ["file server"]:        --no-detach
							 | 
						||
| 
								 | 
							
								      slapd [ldap]:                 -d
							 | 
						||
| 
								 | 
							
								      snmpd [snmp daemon]:          -f
							 | 
						||
| 
								 | 
							
								      svnserve [vcs]:               --foreground
							 | 
						||
| 
								 | 
							
								      syslogd [log server]:         -n
							 | 
						||
| 
								 | 
							
								      tcpserver [super server]:     normal behaviour
							 | 
						||
| 
								 | 
							
								      vsftpd [ftp server]:          normal behaviour (or: config: background=no)
							 | 
						||
| 
								 | 
							
								      xinetd [super server]:        -dontfork
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Those are the daemons that do not offer the possibility (as of release 0.0.8):
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								      - apache (only with debug mode)
							 | 
						||
| 
								 | 
							
								      - inetd (some variants)
							 | 
						||
| 
								 | 
							
								      - nscd (no switch, no configuraton option)
							 | 
						||
| 
								 | 
							
								      - portmap (only with debug mode)
							 |