#!/bin/bash eval "$(ucr shell)" Marktplatz_hosts_deny=() if [ -n "$samba_share_Marktplatz_hosts_deny" ]; then Marktplatz_hosts_deny=( $samba_share_Marktplatz_hosts_deny ) fi othershares_hosts_deny=() if [ -n "$samba_othershares_hosts_deny" ]; then othershares_hosts_deny=( $samba_othershares_hosts_deny ) fi kill_list=() reload_list=() smbstatus=$(smbstatus -pfn) while read -a REPLY; do found=0 for ip in "${Marktplatz_hosts_deny[@]}" "${othershares_hosts_deny[@]}"; do if [ "$ip" = "${REPLY[3]}" ]; then found=1 break fi done if [ "$found" = 1 ]; then kill_list+=("${REPLY[0]}") else reload_list+=("${REPLY[0]}") fi done < <(echo "$smbstatus" | sed -nr 's/^([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9.:]+).*/\1 \2 \3 \4/p') if [ -n "$kill_list" ]; then kill "${kill_list[@]}" fi if [ -n "$reload_list" ]; then kill -HUP "${reload_list[@]}" fi