From 0ab2ba263eeeb663518ea342135b225a3983270e Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 4 Jan 2018 16:55:38 +0100 Subject: [PATCH] Added: kill open shell to allow unmounting of array --- plugins/dynamix/event/unmounting_disks/kill_shell | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/dynamix/event/unmounting_disks/kill_shell diff --git a/plugins/dynamix/event/unmounting_disks/kill_shell b/plugins/dynamix/event/unmounting_disks/kill_shell new file mode 100644 index 000000000..8b5066622 --- /dev/null +++ b/plugins/dynamix/event/unmounting_disks/kill_shell @@ -0,0 +1,5 @@ +#!/bin/bash +# kill any open shell which prevents unmounting of array +for PID in $(lsof /mnt/disk[0-9]* /mnt/cache /mnt/user /mnt/user0 2>/dev/null|grep -vP '^(lsof|grep|awk|COMMAND)'|awk '{print $2}'); do + kill -9 $PID 1>/dev/null 2>&1 +done