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
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 ...
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 ...
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
282
views
Why systemctl status shows a time in the future and the amount of time left?
When we issue "systemctl status", we usually get in the output, a line showing the status and for how long it has been in that status.
Like: (I issued that few minutes ago)
Active: active (...
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.
0
votes
0
answers
331
views
How do I correctly set up systemd-time-wait-sync.service
I have to set up a a timer with onCalendar=*:30 on a Raspberry Pi with no internet connection but using instead a battery powered RTC.
To sync my RTC I followed this post.
On the manual page of ...
0
votes
1
answer
659
views
When does the timer for 'OnBootSec' in a systemd timer unit actually start?
"On Boot" is ambiguous to me. Does it mean when booting starts, when booting finishes, mid boot, when timer.target is met? The documentation that I've read doesn't resolve this ambiguity.
1
vote
2
answers
234
views
How to avoid systemd periodic realtime timer running at boot
I have a realtime timer with Persistent=false running immediately after boot although my objective is to run it periodically!
I saw it is a rather common question but none of the answers I found in ...
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 ...
0
votes
1
answer
390
views
Run systemd timer even if process is still running
It has been confirmed that systemd timers won't start the .service if previous run hasn't finished. However, for unknown reason this blocks some Type=oneshot backup processes on my machine (they seem ...
2
votes
1
answer
147
views
Ensure that systemd timer instances of same template are not running in parallel
I have a systemd timer template [email protected] and a corresponding service [email protected]. The job runs daily and has a generous RandomizedDelaySec of 2 hours. The job has many instances.
Can I tell systemd ...
0
votes
2
answers
96
views
systemd unit "Before=" with timer
In my system I have b.service activated by b.timer. I want another service (a.service) that start before b.service. I cant change b.service or b.timer because are not mine. I've putte Before=b.service ...
0
votes
1
answer
69
views
cronjob: run script_A on boot/wake, then every 5 mins after that, run script_B on each of the 4 mins in between (so *not* just modulo-5 clock-minutes)
So I'd like to set up a cronjob in a very specific way:
run script_A on boot/wake
then every 5 minutes after, relative to that boot/wake (so not just modulo-5 clock-minutes)
run script_B on each of ...
0
votes
3
answers
152
views
systemd.time - OnCalendar= unwanted running after suspend
I wanted a "more stupid" version of crontab: Run only on given times, don't catch up after suspension.
I.e. when a service should have been triggered by crontab, but the machine was ...
0
votes
0
answers
265
views
Why is my systemd-timer not working? (Active = Until)
I created a systemd-timer which should restart a docker container daily but it never does.
That uptime of the docker container is > 1 day, that shows me the container was not restarted
/lib/systemd/...
0
votes
0
answers
286
views
systemctl timer does not seem to trigger its service
I am trying to set up auto-renewal for certbot, and have created the following two files in /etc/systemd/system/:
certbot.service
[Unit]
Description=Let's Encrypt renewal
[Service]
Type=oneshot
...
0
votes
0
answers
361
views
logrotate not as expected
I have a logrotate service configured as below running on a user systemd timer.
The issue is that the target of the rotate is allowed to grow beyond the size specified in the logrotate.conf, and that ...
2
votes
0
answers
389
views
systemd.timer to catch up on missed runs of the services
Following up on Schedule a job every 20 days,
This is for renewing purpose, thus can be done sooner than 20 days. But I'm doing it from my laptop, which would be put into sleep most of the time. Thus ...
3
votes
0
answers
228
views
A monotonic systemd timer that is not distorted by suspension and downtime?
This is what I want: A timer that runs every X minutes by the wall clock. If the computer is asleep, then it should run as soon as it wakes up. And then again and again, every X minutes by the wall ...
0
votes
1
answer
239
views
Why isn't my systemd timer executing my sh script?
My youtube.sh file located in /home/deck/Desktop/youtube.sh:
#1/bin/env bash
pactl -- set-sink-volume 0 100%
xdg-open A youtube video link
My youtube.timer file located in /etc/systemd/system/youtube....
0
votes
1
answer
433
views
Can't disable systemd user timer, Unknown method DisableUnitFilesWithFlagsAndInstallInfo
I have a simple systemd service and timer under ~/.config/systemd/user for building nightly images of my favorite program:
# ~/.config/systemd/user/kicad-build.service
[Unit]
Description=KiCAD nightly ...
2
votes
1
answer
451
views
Activate two "oneshot" services from one systemd timer so that they are started one after another
I have two service oneshots:
one that creates snapshots
one that sends snapshots
The second one (send) should always be executed after the first one (create) is finished. Currently the services, ...
4
votes
1
answer
1k
views
Start request repeated too quickly
I am trying to make a periodic backup (OnCalendar=daily) to my dropbox via rclone. Since this runs on a laptop, I use Persistent=true. If I wake up the laptop, it takes a few seconds until the network ...