diff options
author | Renato Botelho <renato@netgate.com> | 2015-12-10 08:45:46 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-12-10 12:20:56 -0200 |
commit | 48ef563059bb973a8bddc394d1f61e2b9c15db42 (patch) | |
tree | fe0f102a4fdc7c5caefd2c424958c7c36aa08779 | |
parent | ff59b884963ef2a5aaee50c00a286ddd66fa409d (diff) | |
download | pfsense-48ef563059bb973a8bddc394d1f61e2b9c15db42.zip pfsense-48ef563059bb973a8bddc394d1f61e2b9c15db42.tar.gz |
Track nc PID and kill it on _exit()
-rwxr-xr-x | src/usr/local/sbin/pfSense-upgrade | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade index b4a34b8..fb20eec 100755 --- a/src/usr/local/sbin/pfSense-upgrade +++ b/src/usr/local/sbin/pfSense-upgrade @@ -140,6 +140,10 @@ _exit() { /etc/rc.conf_mount_ro fi + if [ -n "${nc_pid}" ] && ps -p ${nc_pid} >/dev/null 2>&1; then + kill ${nc_pid} + fi + local _rc=${1:-"0"} # If EVENT_PIPE is defined, GUI is calling @@ -160,6 +164,7 @@ pkg_with_pb() { _event_pipe="-o EVENT_PIPE=${progress_socket}" nc -lU ${progress_socket} >> ${progress_file} & + nc_pid=$! while [ ! -e "${progress_socket}" ]; do sleep 0.1 @@ -167,6 +172,7 @@ pkg_with_pb() { fi pkg ${_event_pipe} $@ + nc_pid="" return $? } @@ -695,6 +701,9 @@ fi export pkg_chroot="" export chroot_dir="" +# Save nc_pid to be able to kill it +export nc_pid="" + unset dry_run unset dont_reboot unset booting |