#!/bin/sh lnds=$(echo k{sock,qsw,{open,i,v,o2,c}ib,ra,ptl,mx}lnd) do_rmmod() { mod=$1 if grep "^$mod" /proc/modules >/dev/null 2>&1; then rmmod $mod fi } do_rmmod lnet_selftest if lctl network down > /dev/null 2>&1; then for mod in $lnds; do do_rmmod $mod; done rmmod lnet rmmod libcfs fi