Changeset 4f3aa1c for chapter07


Ignore:
Timestamp:
02/23/2001 06:20:39 PM (23 years ago)
Author:
Gerard Beekmans <gerard@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, v3_0, v3_1, v3_2, v3_3, v4_0, v4_1, v5_0, v5_1, v5_1_1, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
0c7e9bd7
Parents:
b092e3d
Message:

Fixed the unnecessary delays in the killproc function

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@210 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/functions.xml

    rb092e3d r4f3aa1c  
    3737evaluate_retval()
    3838{
    39         if [ $? = 0 ]
    40         then
    41                 print_status success
     39        if [ $? = 0 ]
     40        then
     41                print_status success
    4242        else
    4343                print_status failure
     
    9797#
    9898# If no parameters are given to the print_status function, print usage
     99
    99100# information.
    100101
     
    218219
    219220# more PID's were found that belongs to the processes to be killed
     221
    220222#
    221223        if [ -n "$pid" ]
     
    228230                then
    229231                        /bin/kill -TERM $pid
    230 /usr/bin/sleep 2
    231 #
    232 # If after -TERM the PID still exists we'll try killing it with -KILL
    233 # and wait for 2 seconds again to allow the kill to be completed
    234 #
    235  
    236                        if ps h $pid >/dev/null 2>&1
     232#
     233# If after -TERM the PID still exists we'll wait 2 seconds before
     234# trying to kill it with -KILL. If the PID still exist after that, wait
     235# two more seconds. If the PIDs still exist by then it's safe to assume
     236# that we cannot kill these PIDs.
     237#
     238
     239                        if /bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
    237240                        then
    238                                 /bin/kill -KILL $pid
    239 /usr/bin/sleep 2
     241                                /usr/bin/sleep 2
     242                                if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
     243                                then
     244                                        /bin/kill -KILL $pid
     245                                        if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
     246                                        then
     247                                                /usr/bin/sleep 2
     248                                        fi
     249                                fi
    240250                        fi
    241                         /bin/ps h $pid >/dev/null 2>&1
     251                        /bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
    242252                        if [ $? = 0 ]
    243253                        then
     
    262272#
    263273                        /bin/kill $killlevel $pid
    264 /usr/bin/sleep 2
    265                         /bin/ps h $pid >/dev/null 2>&1
     274                        if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
     275                        then
     276                                /usr/bin/sleep 2
     277                        fi
     278                        /bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
    266279                        if [ $? = 0 ]
    267280                        then
     
    294307# reload it's configuration file. This is almost identical to the
    295308# killproc function with the exception that it won't try to kill it with
     309
    296310# a -KILL signal (aka -9)
    297311#
     
    365379#
    366380# If nolevel was set we will use the default reload signal SIGHUP.
     381
    367382#
    368383
Note: See TracChangeset for help on using the changeset viewer.