I have a service that runs a python script:
[Unit]
Description="Daily python service"
[Service]
WorkingDirectory=/home/ubuntu/python_project/
ExecStartPre=/bin/bash -c 'truncate -s 0 /var/log/project.log /var/log/project_error.log'
ExecStart=/home/ubuntu/.conda/envs/test/bin/python -u main.py
StandardOutput=append:/var/log/project.log
StandardError=append:/var/log/project_error.log
[Install]
WantedBy=multi-user.target
I want this to run daily at a specific time:
[Unit]
Description=Run service daily
[Timer]
OnCalendar=*-*-* 12:00:00
Persistent=true
[Install]
WantedBy=timers.target
When I reload the daemon, enable the timer, and start the timer, it runs the first day. But after the first day it stops running automatically, unless I manually stop the service.
Why is this happening? And how do I get around this?