First of all, sorry for not continuing the review yesterday, time is short :(
Still, I'll finish this, as I'd like to have this applied eventually.
Am 02.07.2010 11:21, schrieb Kurt J. Bosch:
> Am 2010-06-30 23:47, schrieb Victor Lowther:
>> Move that shared code into functions.
>> ---
>> functions | 29 +++++++++++++++++++++++++++++
>> rc.shutdown | 32 +-------------------------------
>> rc.single | 27 +--------------------------
>> 3 files changed, 31 insertions(+), 57 deletions(-)
>>
>> diff --git a/functions b/functions
>> index d8e8e54..bf6ed45 100644
>> --- a/functions
>> +++ b/functions
>> @@ -203,6 +203,35 @@ ck_status() {
>> fi
>> }
>>
>> +kill_everything() {
>> + # Find daemons NOT in the DAEMONS array. Shut these down first
>> + for daemon in /var/run/daemons/*; do
>> + [[ -f $daemon ]] || continue
>> + daemon=${daemon##*/}
>> + in_array "$daemon" "${daemo...@]}" || stop_daemon "$daemon"
>> + done
>> +
>> + # Shutdown daemons in reverse order
>> + for ((i=${#daemo...@]}-1; i>=0; i--)); do
>> + [[ ${DAEMONS[$i]:0:1} = '!' ]]&& continue
>> + ck_daemon ${daemons[$...@} || stop_daemon ${daemons[$...@}
>> + done
>> +
>> + # Terminate all processes
>> + stat_busy "Sending SIGTERM To Processes"
>> + run_hook single_prekillall
>
> This line should be run_hook "${0##*/rc.}"_prekillall IMHO
Kurt is right here. We call this code from rc.single and rc.shutdown I
think. We use two distinct hooks, you can register functions for these
hooks independently!
signature.asc
Description: OpenPGP digital signature

