DAEMON(8) COMMAND REFERENCE DAEMON(8) NAME daemon - daemon process handler SYNOPSIS /etc/daemon [ -Ksig ] [ -Ysig ] [ -k ] [ -r ] [ -s ] [ -v ] [ -wtime ] [ -y ] [ program ... ] DESCRIPTION Daemon is used to stop, start, synchronize, and report status of daemon processes. The program arguments must be full pathnames of executable programs followed by any arguments. If no program names are specified, the file /etc/daemontab is read for program names, -K, -Y, and -w options, and commands to execute to obtain program names (see daemontab(5)). If the -k, -K, or -r options are given, the programs are killed. The default kill signal is TERM (15), which is overriden with the -K option on the command line or in the daemontab file. After the kill signal is sent, daemon waits for 5 seconds (or the time specified by the -w option) and checks to make sure that the process was killed. Failures are always reported; sucesses only if the -v is specified. If the -s or -r options are given, the programs that were not running or were successfully killed are executed. The only kind of failure possible is that no process slots are available. The -y and -Y options specify that the program is to be ``synchronously restarted''. This is done by sending the specified signal to the process, which is supposed to tell the process to reread its configuration data. If /etc/daemontab is used, only entries which are preceded by the -Y will be processed. If the -y is given, no programs may be specified on the command line, since there is no default synchronization signal. These restrictions exist because not all daemons can synchronize in this way. After the signal is sent to the process, daemon waits for the time specified by the -w option (or 5 seconds by default) and then checks to see if the process has died. Death of a process in this case is marked as a failure, since the intention was for the process to keep going. The -y and -Y options may not be used with the -k, -K, -s, and -r options. If the -v option is given, all actions taken are reported as they happen. Finally, a table is printed after all other actions are taken. The table looks like the following: Pid Status Action Name --- ------ ------ ---- Printed 5/12/88 1
DAEMON(8) COMMAND REFERENCE DAEMON(8) number status action taken program name with arguments The Pid field contains the process ID number of the program. If the program isn't running, this field is blank. The Status field contains the same information as the STAT field printed by ps(1). If the program isn't running, this field will be (none). The Action field contains a description of what action was taken or why action was not taken. The Name field contains the name of the program and its arguments. Only the superuser may specify options other than -v. If no options are given, -v is set. OPTIONS -Ksig Kill programs with the given signal number or name. This option overrides all options given in the daemontab file. Execute the command ``kill -l'' for a list of signal names. -Ysig Send the specified signal to all programs listed on the command line, or to all programs preceded by a -Y in the daemontab file. The signal given overrides the signals specified in the daemontab file. This option can not be given with -K, -k, -s, or -r. -k Kill programs with default signal, which is either TERM (15) or the signal specified by the -K option in the daemontab file. -r Restart. Equivalent to giving both the -k and -s options. -s Start the programs if they are not running or were succesfully killed. -v Verbose. Print the results of executing commands from the daemontab file, actions taken, and a summary table after all actions are taken. -wtime If the processes are being killed (or restarted), wait time seconds before checking to make sure the process is dead. If the processes are being synchronized, wait time seconds before checking to make sure that the process is still running. The default time is 5 seconds. This option overrides all -w options given in the daemontab file. -y Synchronize processes by sending the signal specified in the daemontab file. If no -Y is given for an entry Printed 5/12/88 2
DAEMON(8) COMMAND REFERENCE DAEMON(8) in the daemontab file, the entry is not processed. This option may not be applied to programs listed on the command line, and may not be given with the -K, -k, -s, and -r options. EXAMPLES This example will print a report about all of the programs listed in /etc/daemontab. No action is taken. /etc/daemon This example will restart all of the programs listed in the daemontab file, as well as those named by executing commands listed in the daemontab file, and print a summary table at the end. /etc/daemon -v -r This example will attempt to kill the program /etc/lookd that is running with the argument debug with the signal INT, will wait 5 seconds before checking to see whether the kill succeeded, and will restart the program if it did succeed. No table is printed. /etc/daemon -K INT -s "/etc/lookd debug" FILES /etc/daemontab Program names and commands to execute for more names. RETURN VALUE [NO_ERRS] Command completed without error. [USAGE] Incorrect command line syntax. Execution terminated. [NP_ERR] An error occurred that was not a system error. Execution terminated. [NP_WARN] An error warranting a warning message occurred. Execution continues. [P_WARN] A system error occurred. Execution continues. See intro(2) for more information on system errors. [P_ERR] A system error occurred. Execution terminated. See intro(2) for more information on system errors. Printed 5/12/88 3
DAEMON(8) COMMAND REFERENCE DAEMON(8) CAVEATS Arguments to programs are significant. If the program /etc/foo is specified and /etc/foo -bar is running, they are not considered to be the same program. Since there is no way to tell if a daemon that is started actually survived, the success of starting a program is determined by whether or not daemon was able to get a new process slot and whether or not the program is executable. To find out if the daemons actually got started, execute daemon again without any options except -v. Some daemons take a long time to die after a kill signal is executed in order to clean up and finish what they are doing. SEE ALSO kill(1), ps(1), and daemontab(5). Printed 5/12/88 4
%%index%% na:288,83; sy:371,503; de:874,3273;4507,732; op:5239,2723;8322,421; ex:8743,1034; fi:9777,191; rv:9968,837; ca:11165,1099; se:12264,188; %%index%%000000000170