Send Email on failure or restart of systemd service on Raspberry Pi

What you learn here about raspberry pi service failure or restart

  • Send email on failure or restart of systemd service

Sometimes while working with raspberry pi we come to situation where we want to restart service automatically and need to send email to desired receiver right ! so here we will see how restart stopped or failed service automatically and how to send email on failure of Service.

Send email on failure or restart of systemd service

Please follow the following steps to know how to Send email on failure or restart of systemd service on raspberry pi using python

Please make sure that you have created service on your raspberry pi which you want to monitor

1)Please first sign in first your Gmail or Email account in the browser.

Please make sure that you have signed in to your Gmail account form which you want to send the email

2)Now please click on the following link to enable security option so that you can send email using python

Gmail allows the app to send email

python send Email

Please make sure that you have followed the above step. Without the above step, you will not be able to send an Email using python

3)Now please click on the following link to enable the captcha option so that you can send an email using python without login the browser.

Gmail unlock captcha to send email

Email send using python

Please make sure that you have followed the above step. If you have followed the above step then you can send Email without sign in the browser. If not then you have to sign in browser to send the email.

4)Now please download the following python code which will monitor service and send Email on restart or failure.

Download Raspberry pi Service Autorestart and Email Send code (12 downloads)

5)Unzip the downloaded code and modify the following things which is shown below

6)Now please run the python code. You can also make this python code as service.

 

This post is contributed by Rahul Gusai. If you like to contribute bytesofgigabytes, you can also write an article using bytesofgigabytes contribute . See your article appearing on the bytesofgigabytes.com main page to help other people.

You may also like...