You can source this file in your login-script (~/.bashrc or similar) with . ~/.emonit.sh if you stored it in ~/.emonit.sh. The script uses some non-sh-compatible syntax. So if you only have sh or ash at hand, some changes are needed.
$ emonit list 'b.*'
$ emonit restart 'b.*'# Will restart the three services listed above (without providing feedback)
One important thing to notice: Mind the glob! ;)
$ emonit restart .* # will expand before it is passed to the script, meaning that the script call will be something like
$ emonit restart . .. .bashrc # what will surely fail. I recommend to always single-quote any input, like
$ emonit restart '.*'# what will simply restart any service available. This also makes use of character classes easier
$ emonit restart 'abc_\d+'# this is equal to the next line
$ emonit restart abc_\\d+
Fix Issue #915: Add support for sevice name regular expressions in monit CLI status, summary, start, stop, restart, unmonitor, monitor commands. Examples:
monit status myservice # exact match
monit status "data.*" # pattern which will match all services whos name contain "data" substring