How do I ensure my python script starts when my Ubuntu system starts and stops when my display is on sleep mode using systemd services
I have created a script that monitors the time each application is running on my main window in Ubuntu OS and sends the data to a PostgreSQL db, The script is working fine but I need to manually start the script and need to keep it’s terminal open, and if my display is suspended or I have not closed my system completely the script keeps on recording the duration of application on window. After some searching I realized using systemd services I can ensure the script starts when my system starts and stops if the display is on sleep mode or suspended.