Changeset 28626


Ignore:
Timestamp:
2011-10-27T18:52:31+02:00 (6 years ago)
Author:
jow
Message:

[package] base-files: sysupgrade: kill all but essential processes before starting the update

Location:
trunk/package/base-files
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/Makefile

    r28616 r28626  
    1111 
    1212PKG_NAME:=base-files 
    13 PKG_RELEASE:=84 
     13PKG_RELEASE:=85 
    1414 
    1515PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ 
  • trunk/package/base-files/files/lib/upgrade/common.sh

    r28616 r28626  
    7676        # spawn a new shell from ramdisk to reduce the probability of cache issues 
    7777        exec /bin/busybox ash -c "$*" 
     78} 
     79 
     80kill_remaining() { # [ <signal> ] 
     81        local sig="${1:-TERM}" 
     82        echo -n "Sending $sig to remaing processes ... " 
     83        top -bn1 | while read pid ppid user stat vsz pvsz pcpu cmd args; do 
     84                case "$pid" in 
     85                        [0-9]*) : ;; 
     86                        *) continue ;; 
     87                esac 
     88                case "$cmd" in 
     89                        # Skip kernel threads and essential services 
     90                        \[*\]|*ash*|*init*|*watchdog*|*ssh*|*dropbear*|*telnet*|*login*) : ;; 
     91 
     92                        # Killable process 
     93                        *) 
     94                                if [ $pid -ne $$ ] && [ $ppid -ne $$ ]; then 
     95                                        echo -n "${cmd##*/} " 
     96                                        kill -$sig $pid 2>/dev/null 
     97                                fi 
     98                        ;; 
     99                esac 
     100        done 
     101        echo "" 
    78102} 
    79103 
  • trunk/package/base-files/files/sbin/sysupgrade

    r27630 r28626  
    128128        export SAVE_CONFIG=0 
    129129fi 
     130 
     131kill_remaining TERM 
     132sleep 3 
     133kill_remaining KILL 
     134 
    130135run_hooks "" $sysupgrade_pre_upgrade 
    131136 
Note: See TracChangeset for help on using the changeset viewer.