Page 1 sur 1

Etre notifie par email par script bash

Publié : 27 sept. 2016, 19:24
par ziaziung
Bonjour, j'utilise le script bash qui permet de relancer le service domoticz :

if pgrep domoticz; then
echo "domoticz fonctionne"
else
sudo service domoticz.sh start
fi


Comment pourrais je être notifié par email lorsque le service est redémarré (je suis chez Free)?

Merci par avance de votre aide.

Re: Etre notifie par email par script bash

Publié : 27 sept. 2016, 21:40
par patrice
Bonsoir

A la fin du script domoticz.sh fais toi envoyer un mail par un
echo "nous venons de redémarrer à l’instant même votre honneur" |mail -s "redémarrage domoticz" toto@toto.net
Attention lors des mise à jour , je pense que le domoticz.sh est remplacé par un éventuel nouveau fichier et donc sans cette modif.

Re: Etre notifie par email par script bash

Publié : 29 sept. 2016, 16:16
par ziaziung
Bonjour. J'ai fait ce que tu me dis
echo "nous venons de redémarrer à l’instant même votre honneur" |mail -s "redémarrage domoticz" monadresseamoi@free.fr

ou avec l'espace
echo "nous venons de redémarrer à l’instant même votre honneur" | mail -s "redémarrage domoticz" monadresseamoi@toto.net


et j'obtiens
mail : commande introuvable



Ben pourquoi?????


Merci de votre aide

Re: Etre notifie par email par script bash

Publié : 29 sept. 2016, 21:10
par patrice
Bonsoir
sudo apt-get install mailutils

Re: Etre notifie par email par script bash

Publié : 29 sept. 2016, 21:27
par georges.attali
Bonjour,
ici : http://www.zem.fr/curl-15-commandes-pra ... avec-curl/ , il explique comment "Envoyer un email avec cURL" (tout en bas).
normalement pas d'installation à faire, curl est déjà installé, MAIS je n'ai pas testé moi-même.
Bye, GD

Re: Etre notifie par email par script bash

Publié : 02 oct. 2016, 11:23
par ziaziung
Merci pour votre aide.

J'ai réussi à faire ce que je voulais en
intallant mailutils
installant msmpt