CodexBloom - Programming Q&A Platform

Fedora 38 - Systemd Timer Not Triggering Service as Expected Despite Correct Configuration

👀 Views: 34 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-06
linux systemd fedora bash

I'm getting frustrated with I'm working on a personal project and I'm writing unit tests and I've looked through the documentation and I'm still confused about I'm having trouble with a systemd timer on Fedora 38 that doesn't seem to trigger the associated service as expected... I've set up a timer to run a simple script every 10 minutes, but the service is never executed. Here's the configuration for my timer and service: **Service file (my_script.service):** ```ini [Unit] Description=Run My Script [Service] Type=oneshot ExecStart=/usr/local/bin/my_script.sh ``` **Timer file (my_script.timer):** ```ini [Unit] Description=Timer to run my script every 10 minutes [Timer] OnActiveSec=10min Unit=my_script.service Persistent=true [Install] WantedBy=timers.target ``` I have enabled and started the timer with the following commands: ```bash sudo systemctl enable my_script.timer sudo systemctl start my_script.timer ``` When I check the status of the timer, it shows that it is active, but my script is never run. I also looked at the logs using `journalctl -u my_script.timer` and noticed an entry saying: `my_script.timer: Unexpected behavior: Failed to start unit: Unit my_script.service not found.` I'm not sure why it's reporting that the unit need to be found when I've double-checked that the service file is located in `/etc/systemd/system/`. I've also tried reloading the systemd daemon with `sudo systemctl daemon-reload` after making changes. Can anyone guide to troubleshoot this scenario? What could be causing the timer not to trigger the service, and how can I resolve it? For context: I'm using Bash on Ubuntu. Am I missing something obvious? What am I doing wrong? My team is using Bash for this desktop app. I'd love to hear your thoughts on this. I'm working in a Ubuntu 22.04 environment. What's the best practice here?