[arch-general] [PATCH 21/48] Both rc.single and rc.shutdown use the same code to kill everything.
Thomas Bächler
thomas at archlinux.org
Fri Jul 2 05:27:45 EDT 2010
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" "${DAEMONS[@]}" || stop_daemon "$daemon"
>> + done
>> +
>> + # Shutdown daemons in reverse order
>> + for ((i=${#DAEMONS[@]}-1; i>=0; i--)); do
>> + [[ ${DAEMONS[$i]:0:1} = '!' ]]&& continue
>> + ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
>> + 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20100702/efe5257e/attachment.bin>
More information about the arch-general
mailing list