Questions tagged [systemd-timer]
The systemd-timer tag has no usage guidance.
159
questions
0
votes
1
answer
31
views
Timer "OnUnitInactiveSec=1day" is not triggered as expected
I wanted to run a service that runs once per day (exact time of day is not important right now).
My interpretation of
OnUnitInactiveSec= defines a timer relative to when the unit the timer is ...
0
votes
2
answers
2k
views
Unit templates and non-template destination units
I like to keep my custom unit files in their own directory away from /etc. In 247 this worked well, using something like the following:
systemctl enable /path/to/unit.service
This also worked with ...
0
votes
2
answers
1k
views
How can I specify a maximum service duration in systemd service?
I have a problem where on rare occasions my Type=simple systemd service hangs or gets caught in a loop. This causes its timer to stop scheduling the service because, as confirmed with sudo systemctl ...
5
votes
3
answers
2k
views
Instruct to execute an unit after completing another unit successfully
I use cloud-config to install and configure DCOS cluster.
Normally agentinstall.service service takes 5 minutes to complete.
Is it possible to instruct to systemd to execute agentconfigure.service ...
0
votes
1
answer
31
views
Systemd timer only starts when service is stopped
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/...
0
votes
1
answer
64
views
Is there a way to schedule a lazy timer relative to another timer?
(x-mas.service)
[Unit]
Description=Celebrate X-Mas
[Service]
Type=simple
ExecStart=/usr/sbin/x-mas-day
[Install]
WantedBy=multi-user.target
(x-mas.timer)
[Unit]
Description=Add "X-Mas" to ...
145
votes
4
answers
76k
views
Cron vs systemd timers
It was recently pointed out to me that an alternative to cron exists, namely systemd timers.
However, I know nothing about systemd or systemd timers. I have only used cron.
There is a little ...
3
votes
1
answer
111
views
Managing ordering dependencies between systemd template instances
Abstracted example:
I have two recurring tasks A and B that I want to setup as systemd services. As the tasks are quite similar to each other, I am using a template [email protected]; A and B will be ...
10
votes
2
answers
7k
views
timer with multiple oncalendar moments
I'm using a systemd timer and unit to automatically trigger a backup job. But currently it runs only at one moment in the evening. Is it possible to have it run at multiple moments by declaring it in ...
2
votes
0
answers
59
views
Systemd - run bash script after user login on specific days
I use the i3 window manager and every day of remote work I would like to run a script that is responsible for setting up my monitors. On Tuesdays, I work onsite, then I'll want to run another script.
...
1
vote
1
answer
74
views
Ubuntu systemd service with timer is slow
I've set up a systemd timer to trigger a service every minute on Ubuntu 22.04, but I'm encountering an issue where the execution time of the service significantly increases after the first run. The ...
0
votes
1
answer
65
views
Systemd executable failed to read file from CacheDirectory with Permission Denied
I have a Golang binary that runs every 5 mins. It is supposed to create & update a text file which needs to be write restricted. To run this binary I created a systemd service and a systemd timer ...
0
votes
0
answers
47
views
systemd timers with long lived processes, avoiding overlaps
I have script that will scan for tasks, and work on one at a time to completion and then exit. Execution can last 1s (no tasks) to 2hours (heavy task). And subsequent runs should start as soon as ...
0
votes
1
answer
66
views
How to indicate hour range in Timer using OnCalendar?
systemd 219 version
Ubuntu 22.04.2 LTS
[Unit]
Description=Run myscript.service every 5 minutes
[Timer]
OnCalendar= *-*-* 10-23:10/5:00
Persistent=true
[Install]
WantedBy=timers.target
I need to run ...
3
votes
1
answer
448
views
systemd timer every 1 hour and X minutes?
I'm looking for a systemd timer to run every 1 hour and 18 minutes but I have this only lead.
systemd-analyze --iterations=3 calendar *:0/18 which is every 18 minutes.