Use watch to monitor status commands in bash
If you need to monitor a status command such as monit status
or service nginx status
, instead of calling the command over and over use the watch
command:
watch monit status
by default it will refresh the status every 2 seconds and highlight changes as they occur.
You can modify the interval by using the -n
switch:
watch -n 1 monit status
If your status command uses color you can turn it on by using the -c
switch.
P.S. If you need to run this command on mac you will need to install the watch package using homebrew.
Tweet