# The Watcher Is a shell script that run commands and monitor wether return has changed. If so, it send and email. It depends on `sqlite`. ``` $ apt install sqlite3 ``` It's intended periodically run by cron It's there, on `chif.fr` : `/home/admin/girofle.cloud/scripts/the-watcher.sh` ## To add a watcher Here is the one that check wether ipv6 is configured ``` function watcher_IPv6() { app="ipv6" ping6 -c 1 -W 2 2001:4860:4860::8888 >/dev/null ; _ec=$? if codeHasChanged "$app" "$_ec" ; then message "IPv6 changed from $(getCode "$app") to $_ec" fi storeCode "$app" "$_ec" } ``` Take it as example : - write a new `function` named `watcher_`. Line MUST starts with `function` ! - `app` is the thing you are monitoring - `codeHasChanged` return `true` or `false` wether the app's returned has changed - `getCode` return the last return of a given app - `storeCode` store the return of an app - `message` store the message to be send via email