I have a barebones FreeBSD system with only a terminal. I would like to monitor zpool status every 15 seconds or so. Usually on regular systems I would use watch -n15 but this is not available here.I don't know if I want to go into installing new programs on an important and possible fragile host. But I'm open to do it if it's really simple, I have heard about a replacement called cmdwatch.My simple solution to monitoring the program is to use a while loop, namely:while :; do zpool status && sleep 15; doneThis ostensible works. However, now I can't break the loop using Ctrl + C, which is a big nuisance. I can use Ctrl + Z to put the loop in the background, call ps to get the PID and then kill -9 the program. Regular kill doesn't work.So this is not good enough. For any user who is not me the system looks broken. Another post pointed me to checking that the return code is greater than 128, SIGINT should give 130, like thiswhile [ 1 ]; do zpool status; test $? -gt 128 && break; doneThis works if I run only the sleep 15 command. Chaining more commands together either with ; or && gives the old situation where I can't interrupt the loop.What do I do?
Break infinite 'while' loop on FreeBSD
freebsd;kill;signals;sleep;watch