Google API Gmail LINE Notifications Part 7

Final part in a series of articles on implementing a notification system using Gmail and Line Bot.

Gmail Python Line Bot
1. Installation & First Run
2. Labels
3. Getting the Emails
4. Processing Email Contents
5. Processing Email - Being Selective
6. Processing Email - Single Script / Multiple Emails
7. Automation & Code

This will be the final instalment of this series. Today I will briefly share how the systemd configuration files are set and provide a link to the GitHub repo.

Systemd Service

I am running my code under Debian. In order to learn something new. I chose to use systemd to provide scheduling for the script execution.

These files should be placed under /etc/systemd/system

Here is the script: gnotifier.service

Description=Monitor Gmail Notifier

ExecStart=/usr/bin/python3 /home/ACCOUNT/gmail/


This is fairly straight forward. The filename itself provides the service name gnotifier. We also specify that this script executes once and terminates: oneshot. To have the service execute multiple times we provide the Wants=gnotifier.timer; this says that we need to read gnotifier.timer to get schedule information.

Systemd Timers


Description=Triggers gnotifier service

# KidzDuo arriving
OnCalendar=Mon,Tue,Thu *-*-* 14:20,25,30,35,40,45,50,55:00
# Swimming
OnCalendar=Wed *-*-* 15:50,55:00
OnCalendar=Wed *-*-* 16:0,5,10,15,20:00
OnCalendar=Wed *-*-* 18:0,5,10,15,20,25:00
# KidzDuo Leaving
OnCalendar=Mon,Tue,Thu *-*-* 18:0,5,10,15,20,25,30,35:00
OnCalendar=Mon,Tue,Thu *-*-* 19:0,5,10,15,20,25:00


There are many ways to configure the timers. Here I have chosen OnCalendar Let’s take a look at one example: OnCalendar=Mon,Tue,Thu *-*-* 14:20,25,30,35,40,45,50,55:00

Days of the week: Mon,Tue,Thu
Hour: 14 (2pm)
Minutes: 20,25,30,35,40,45,50,55 Every 5 minutes starting at 20 minutes.
Seconds: 00

Enable the service

You will need to issue the following commands

systemctl enable gnotifier
systemctl start gnotifier

You can check your systemd timers using

systemctl list-timers

Some references

OpenSource Article
ArchLinux Wiki

GitHub Repo

You can find the code for this project here.

See also