Systemd.timer OnUnitActiveSec help

I have a couple scripts that I’d like to run 30 mins after boot and 2 hours thereafter. So in view of that I decided to create a systemd timer unit. I’d like to think all the parameters set are correct, but after the first run it disables itself and does not wake up after time has elapsed.

Given below is a simple test case I’m using for debug.


  1. Create script to be run.



echo “$(date): Run complete”

  1. Grant execute on the script

chmod u+x

  1. Create timer unit

sudo vim .config/systemd/user/test.timer

Description=test timer
RefuseManualStart=false # Allow manual starts
RefuseManualStop=false # Allow manual stops



  1. Create test.service

sudo vim .config/systemd/user/test.service

Description=test timer accuracy



  1. Enable it

systemctl --user enable test.service
#Created symlink /home/user1/.config/systemd/user/ → /home/user1/.config/systemd/user/test.service.
systemctl --user start test.service

However, when I look at its status -

○ test.service - test timer accuracy
Loaded: loaded (/home/user1/.config/systemd/user/test.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2022-03-25 14:51:37 IST; 18min ago
TriggeredBy: ○ test.timer
Process: 70897 ExecStart=/home/user1/ (code=exited, status=0/SUCCESS)
Main PID: 70897 (code=exited, status=0/SUCCESS)
CPU: 6ms

Mar 25 14:51:37 wrapper systemd[4520]: Started test timer accuracy.
Mar 25 14:51:37 wrapper[70897]: Friday 25 March 2022 02:51:37 PM IST: Run complete

If anyone has ideas on how to debug/fix and can share them, would appreciate it. If more information is needed let me know.

remove these lines.

Better use OnUnitInactiveSec

You might want to remove these lines form your service.

enable and start the timer, not the service. The service is started by the timer, not the other way around.

You can list timers and check the status of the timer.

systemctl --user status test.timer


systemctl --user list-timers

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.