This checks for the existence of the files, alerts/exits if they are missing:
# Delete all sensors
if [ -f "/etc/nsm/sensortab" ];
then for INTERFACE in `cat "/etc/nsm/sensortab" | grep -v "^#" |cut -f1`
echo y | nsm_sensor_del --sensor-name="$INTERFACE"
else echo "Sensortab appears to be missing! No sensors changed.";
# Delete all servers (should only be one)
if [ -f "/etc/nsm/servertab" ];
then for SERVER in `cat "/etc/nsm/servertab" | grep -v "^#" |cut -f1`
echo y | nsm_server_del --server-name="$SERVER"
else echo "Servertab appears to be missing! No servers changed.";
Ubuntu 12.04.5 LTS
Tested against dummy files and NOT calling nsm_server/sensor_del.
Hope this helps.
Tim Whisnant - @heywiz
Original comment by timothyw...@gmail.com on 11 Dec 2014 at 5:39