I have a systemd user unit that is activated and has a timer to run every day at a certain time. The problem I am having is that if the server is rebooted (and I don't know when that might happen) the service stops running and then I eventually notice the process has not run for a while and I login... It then starts right when I login and begins to run.
How can I make it so that it automatically resumes the timer/service when the server is rebooted so I can avoid having random outages of my process?
service file
[Unit]
Description=daily process update
AssertHost=ai1
[Service]
WorkingDirectory=/st2/process
ExecStart=/home/user/.venv/env/bin/python main.py --update_data
[Install]
WantedBy=default.target
timer file
[Unit]
Description=run process update daily
AssertHost=myserver
[Timer]
OnCalendar=--* 14:20:00
Persistent=true
[Install]
WantedBy=timers.target
installed with the following script
# systemd does not support symlinks across partitions, copy service and timer to user dir
# enable timer which calls service by the same name
# https://askubuntu.com/questions/1083537/how-do-i-properly-install-a-systemd-timer-and-service
cp ./stock-update.service /home/user/.config/systemd/user/process-update.service
cp ./stock-update.timer /home/user/.config/systemd/user/process-update.timer
systemctl --user disable process-update.timer
systemctl --user daemon-reload
systemctl --user enable --now process-update.timer