30 lines
698 B
Markdown
30 lines
698 B
Markdown
|
|
||
|
|
||
|
Install
|
||
|
=======
|
||
|
|
||
|
Install `msmtp` package:
|
||
|
|
||
|
sudo apt install msmtp
|
||
|
|
||
|
Configuration, see [ubuntu-rf.org](https://doc.ubuntu-fr.org/tutoriel/comment_envoyer_un_mail_par_smtp_en_ligne_de_commande)
|
||
|
|
||
|
|
||
|
Use
|
||
|
===
|
||
|
|
||
|
To add it to the cron tab:
|
||
|
|
||
|
crontab -e
|
||
|
|
||
|
The add new line (to run the check once per hour)
|
||
|
|
||
|
1 * * * * /home/alban/outils/warn-if-broken/warn-if-broken-url.sh >/dev/null 2>&1
|
||
|
|
||
|
|
||
|
**Note:**
|
||
|
- Normaly cron send task outputs (echo) via mail. As the MTA (Mail Transfert Agent), may not be set up,
|
||
|
the crontab line redirect the outputs into `/dev/null`.
|
||
|
- No sudo is needed, msmtp and crontab are call with current user.
|
||
|
- The logs can be seen using (with sudo): `sudo grep CRON /var/log/syslog`
|