Next: 3.3 Changing media Up: 3 Administration and Maintenance Previous: 3.1 Checking the pipeline

3.2 Killing and Restarting daemons

3.2.1 Killing daemons

Killing a single daemon

The best way to kill a daemon is to use the kill_daemon command followed by the name of the daemon. For example:

kill_daemoncopyd
This command guaranties that the daemon will die gracefully. First the .status file in the daemon's working directory is checked. If the status is not IDLE, then the daemon is not killed and the operator has to retry the command later. Otherwise, a Unix kill command is issued against the pid found in the .pid file. Then the list of the current processes is checked to see if the process is really dead. Eventually, the daemon's .status file is removed so that the daemon may be normally restarted later.

Killing (stopping) the whole pipeline

The best way to take the whole pipeline down (that is to kill all the archive daemons) is to use the kill_archive command (no argument). This command simply invokes the previous kill_daemon command for each of the daemons making up the pipeline. A mail message is then sent to the archive managers to warn of the attempt to stop the pipeline, with a diagnostic message (success or failure) and a copy of the standard output of the command. Like the kill_daemon command, the kill_archive command may have to be issued several times before all the daemons can be killed.

3.2.2 Starting daemons

Starting a single daemon

The best way to start a daemon is to use the start_daemon command followed by the name of the daemon. For example:

start_daemoncopyd
This command guaranties that the daemon will be started only if it previously died gracefully, namely by checking that there is no .status file in the daemon's working directory. However, even if a .status file is found, the daemon may be safely restarted if both the following conditions are met: The main reason for implementing this feature is in case, for some reason, the archive machine reboots (after a power failure for example). Then all the daemons are killed, but none dies gracefully. However, a daemon spends most of its time idle so the odds are good that the incident occurs while most (if not all) the daemons are sleeping. In this case, the daemon may be restarted without risk.

N.B.: The archive manager can force any daemon to be restarted only by removing the .status file in the daemon's working directory. However this is risky business and before doing this chapter 6 should be consulted.

Starting the whole pipeline

The best way to start the whole pipeline (that is to start all the archive daemons) is to use the start_archive command (no argument). This command simply invokes the previous start_daemon command for each of the daemons making up the pipeline. A mail message is then sent to the archive managers to warn of the attempt to start the pipeline, with a diagnostic message (success or failure) and a copy of the standard output of the command.

Automatic restart

An invocation to the start_archive command has been added to the /etc/rc.special file to allow an automatic restart of the archive pipeline at the end of the booting process (/etc/rc.special is executed as root so a set-uid to archive is performed before running start_archive). This feature can be handy in case of an incident (like a power failure) that forced the archive machine to reboot. Then when the machine comes back up, each archive daemon are automatically restarted provided it was idle when the incident occured (which, as we mentionned earlier, is rather likely). The mail message sent by the start_archive command will immediatly warn the archive manager that an incident occured.

NB: Before shutting down the archive machine, make sure to shut down the archive pipeline properly so as it can be restarted automatically at the end of the reboot process.



Next: 3.3 Changing media Up: 3 Administration and Maintenance Previous: 3.1 Checking the pipeline


archive@cfht.hawaii.edu