Best Practices

Keep in mind these important tips

As you develop your scripts that utilize monitor.chat.sh, you should keep in mind the following:

  • Maintain a list of scripts and code files that call the monitor.chat.sh script.
  • Use recursive grep to find files that are calling monitor.chat.sh, for example:
# look in all the php files to see which ones are calling monitor.chat.sh:
find /var/www -name "*.php" -type f | xargs grep -l monitor.chat.sh

# look in my ~/bin directory to see which files are calling monitor.chat.sh:
find ~/bin/ -type f | xargs grep -l monitor.chat.sh
  • You can safely disable the monitor.chat.sh script simply by adding exit as a line of code directly under #!/bin/bash
  • While you are developing a new script, send the messages to the test chatroom monitor.test@e2e.chat by using “test” as the second parameter.
  • Avoid placing the monitor.chat.sh script in any loop. It could get your server blocked! It is better to aggregate the results of a loop and send them in a single message after the loop has completed.
  • Use a desktop XMPP client to review your messages while you are developing scripts.
Last modified December 4, 2020