Skip to the content.

Notify

Receive daily reports about your node directly from your email.

Buy me a coffee ☕︎

Install

$ cd notify/
$ python3 setup.py install --user

Verify it’s installed:

$ notify --help

Configuration

Configuring SMTP Client.

$ notify "" --edit-config

Follow the tutorials if you use these E-MAIL providers Gmail or Outlook.

"email.smtp.host" = "smtp.gmail.com"
"email.smtp.port" = "465"
"email.smtp.user" = "user@gmail.com"
"email.smtp.pass" = "password"
"email.list" = ["to@gmail.com"]

:warning: Not use an email and password that you use on a daily basis on the computer that this software can be hacked and the configuration file is in plain text, preferably create a new email.

Testing Email Delivery

This command will take the result of the “whoami” command and send it as a message to the emails specified in the configuration file.

$ whoami | notify "Hello, %s" --subject="Hello?"

Check your email now.

Send a “Good morning” email if the time is in the range of 06:00 to 06:50.

$ whoami | notify "Good Morning, %s" --subject "Let's wake up?" --exptime "range 06:00 in 06:50"

Send a email if the output of a command is non-zero.

$ python3 -c "print(5-5)" | notify "The Result is non-zero." --nonzero

Using Crontab

First let’s create a bash script, so that crontab can run at a certain time.

$ which bos
$ which notify
$ nano ~/notify/report.sh

Let’s use BOS to generate a report about the node replace /path/bos and /path/notify with the path shown with the which command.

#!/bin/bash
/path/bos report --styled | /path/notify "%s" --subject="Daily node update"

Now we are going to configure crontab but before that you should be familiar with it, Google it to be more familiar.

$ crontab -e

We are configuring the crontab so that when the time comes to 23:59 it executes the script in bash specified.

# m h  dom mon dow   command
59 23 * * * /bin/bash ~/notify/report.sh

Thanks for this tool your contribution will be welcome :)