listing of daemons running on a unix server
Lance S. Nehring
lnehrin at uswest.com
Wed Dec 9 19:01:42 GMT 1998
Luke Kenneth Casson Leighton wrote:
> PLEASE REPLY TO SAMBA-TECHNICAL, THANKS
> is there a way to obtain a list of daemons running? is there a method for
> starting / stopping them?
I'm not aware of any UNIX standard way of asking which daemons are alive.
Each daemon is expected to be well-behaved and write error messages via the
syslog facility. That leaves two options:
1) Use the ps command (or C function calls - e.g. pstat_getproc() on HP-UX)
to get information on running executables by name. This assumes you know
the daemons' true name.
2) Use lsof (or some functions from it's source) to look up processes that
have a particular file of network socket open. Here's a very small example
of what lsof tells me about one of my concurrent TCP servers running on port
6968. It shows the listener and two forked children that each have an
accepted socket.
lsof -i TCP:6968
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
wmsps 2064 wms 4u inet 0x07419e00 0t0 TCP *:6968 (LISTEN)
wmsps 3141 wms 5u inet 0x07e7ca00 0t93815 TCP larry:6968->curly:2006
(ESTABLISHED)
wmsps 3142 wms 5u inet 0x0803d900 0t94356 TCP larry:6968->curly:2008
(ESTABLISHED)
> on slackware, for example, /etc/rc.d/pcmcia.d has "start|stop|restart"
> which isn't particularly good. on redhat there is a directory where every
> script in it has "start|stop|restart".
>
> what i really wanted was something under program control (c code),
> although scripts would do. and yet another smb.conf option listing where
> a file is that contains the scripts.
You'll probably want to be constrained to using the RC scripts for starting
and stopping the daemons. They are expected to contain all the necessary
housekeeping tasks (e.g. setting up an environment) for a particular daemon
and provide the single point for doing so.
> why i am asking is because i have "service control manager" running on the
> latest version of samba, and i wanted to start / stop / restart httpd,
> imapd, syslogd etc etc.
Why is samba wanting to control httpd, imapd or syslogd? These are not
samba-specific daemons and the OS will need to control them based on the
runlevel (using the RC scripts) whether samba is alive or not. Just
curious......
r,
Lance S. Nehring <lnehrin at uswest.com>
>
>
> luke
More information about the samba-technical
mailing list