Questions tagged [systemd-timer]
The systemd-timer tag has no usage guidance.
150
questions
0
votes
1
answer
21
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.
0
votes
0
answers
27
views
systemd timer with WakeSystem=true not counting down during suspend?
Ref: 1 2 3
I'm trying to schedule a one-time task using systemd-run and WakeSystem=true, that would wake the system when the the timer elapses and execute the command specified. However after the ...
1
vote
1
answer
59
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
89
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 ...
-1
votes
1
answer
89
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
48
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 ...
0
votes
1
answer
30
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
41
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
40
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
2
answers
33
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
79
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
81
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
81
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 ...
1
vote
0
answers
95
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
117
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
0
answers
92
views
Using systemd timers every hour with multiple commands
First time user trying to switch from cron to systemd timers.
Currently I have a crontab with the following line:
10 * * * * cd /some/where; export ENV_VAR=...; ./executable with params
Is such cron's ...
0
votes
1
answer
129
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
201
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
169
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
506
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 ...
1
vote
1
answer
155
views
Using systemd timer to change the background wallpaper
I am trying to use systemd timers to change my background wallpaper and it doesn't seem to be doing what I want.
Blelow I have listed the relevant files and outputs that I have.
bgchange.timer
[Unit]
...
0
votes
1
answer
247
views
How do you create a systemd user timer that will start only after X has started?
I currently have this timer:
[Unit]
Description=Schedule wallpaper rotation
[Timer]
OnCalendar=*-*-* *:00:00
Persistent=true
[Install]
WantedBy=graphical-session.target
Which runs this service:
[...
0
votes
0
answers
76
views
Delay/Retry a systemd timer until display
I have a script to automatically switch the DE's theme based on time, automated by pair of user service and timer.
But the script fails when the DE isn't fully started and I was left with a wrong ...
2
votes
0
answers
234
views
Systemd - stop service at calendar time
I have a systemd service I would like to keep running between set times (let's say midnight to 6 AM).
The closest thing I have found so far is limiting it to a set amount of runtime:
[Unit]
...
0
votes
1
answer
461
views
systemd: Failed to parse calendar specification, ignoring
I am trying to clean my docker registry daily using systemd:
Here is myfile contents:
[Unit]
Description=registry-gc
[Timer]
OnCalendar=41 15 * * *
Persistent=true
[Install]
WantedBy=timers.target
...
2
votes
1
answer
511
views
How to display echo messages from a systemd-timer script in journalctl?
I run via a systemd timer a shell script that starts some programs (they display some output) and uses echo to provide some feedback.
root@srv ~ [127]# cat /etc/systemd/system/borg.timer
[Unit]
...
0
votes
1
answer
766
views
systemd: Failed to parse calendar specification, ignoring: 5m
I am trying to get a simple systemd service to run on a timer unit. For some reason, systemd doesn't seem to like the way I am specifying time. The script worked when I used minutely or daily as the ...
3
votes
0
answers
827
views
How to edit a systemd timer where persistent=true?
This on a Raspberry Pi 4 running Buster.
I have a systemd timer that runs once a day at a particular time. I also have persistent=true. I want to change that time. But, if I edit the file with a new ...
2
votes
1
answer
490
views
How to create an ephemeral user-level systemd timer on the commandline without unit/timer files?
Suppose I want to run the command notify-send "invoked" "$(date)" every 5 seconds using systemd timers.
I know how to create a corresponding unit file and a timer file, then enable ...
0
votes
1
answer
153
views
Systemd: Start service if a path is found but only between 9AM and 6PM
I wonder if there's some way to have both the functionality of a Path unit and a Timer. The idea is to start a specific service if a path on the system is found but only between 9AM and 6PM.
Currently ...
0
votes
1
answer
386
views
systemd timer does not display trigger & does not repeat
As explained in GoAccess 1.4 detailed tutorial, I've create a goa-daily.timer
[Unit]
Description=Daily update of GoAccess reports
[Timer]
# Every day @ 3 O'clock
OnCalendar=*-*-* 03:00:00
...
0
votes
1
answer
667
views
Trouble with keeping process launched by systemd service alive
I am trying to to get my first systemd service working as desired. Here is what I have:
gateway-watchdog.service:
# A systemd service for the Gateway Watchdog
[Unit]
Description=gateway-watchdog: ...
2
votes
1
answer
2k
views
disabled/static systemd service unit is always started at reboot (systemd timers as cron replacement)
Summary
A systemd service unit that is disabled ("static") and is only supposed to be triggered by a timer is run on every reboot.
Background
This was a service unit (in /etc/systemd/system/)...
0
votes
3
answers
127
views
What is the easiest way to run a program from time X to time Y?
There is a certain potentially failing process that I want to run until it succeeds, during the night time, say, from 23:00 to 7:00, but not later.
A possible solution would be to:
Add a cron job for ...
0
votes
0
answers
67
views
What is the most efficient way to run a task every X hours of runtime, accumulated over all power-ons?
Let us assume that I have a machine which wakes up at 7:00, does some work, usually for 15 minutes, but sometimes for days (e.g., experiment supervision), and after the works is done, it powers ...
2
votes
1
answer
1k
views
OnCalendar systemd timer unit still executes at boot, how to stop it?
I have the following unit enabled and started
[Unit]
Description=Schedule a nightly execution at 03.15 for Backup ROOT
# Allow manual start
RefuseManualStart=no
# Allow manual stop
RefuseManualStop=no
...
0
votes
1
answer
1k
views
Systemctl service not killed after timeout on RuntimeMaxSec
My script runs every minute (with systemctl timer) but it will occasionally hang for ever, meaning that unless I manually stop it, it won't run again. So I implemented a timeout with RuntimeMaxSec but ...
0
votes
1
answer
97
views
Changing Unit Configuration to restart httpd every 3s
I tried to add the following with systemctl edit httpd.service and this created /etc/systemd/system/httpd.service.d/override.confcontaining :
[Unit]
Restart=always
RestartSec=3
now after systemctl ...
0
votes
1
answer
951
views
Is it possible to dynamically update systemd-timer's onCalendar?
sytemd-timer has a feature "onCalendar" using which we can execute a script on points of time (on calendar).
Is it possible to dynamically (programmatically) update or mutate that field?
For ...
2
votes
1
answer
1k
views
How to bind a user-level systemd service to network events?
I want to bind a user systemd timer (or service) to network events. For example consider this service:
[Unit]
Description=shows if connection changed
[Service]
Type=oneshot
Environment=DISPLAY=:0
...
7
votes
1
answer
2k
views
How to make a systemd-timer depend on internet connectivity?
I'm using systemd-timer to periodically run a script which consumes a webservice.
Problem is, upon system resume or wake-up, internet connectivity would not get started right away but the timer gets ...
1
vote
1
answer
252
views
systemd daily timer quits scheduling new events
I've been using a systemd timer reliably for months, but recently got alerted that the triggered service job hadn't run. When I used systemctl list-timers, indeed I saw that no more triggering events ...
2
votes
1
answer
202
views
Hourly systemd timer for work hours when end of day is after midnight?
I would like to run a systemd service hourly from 9am in the morning to 1am at night (one hour past midnight local time).
As a starting point I can use a time specification similar to the following to ...
0
votes
2
answers
782
views
Have systemd timer to run immediately when started?
I have a timer that should run every 60 seconds like this:
[Unit]
Description=Trigger test timer
[Timer]
OnActiveSec=60
The timer triggers after waiting 60 seconds. But I want it to trigger ...
0
votes
1
answer
101
views
Directory mtime is not updated when creating a file in it only through a systemd timer, works fine when running the same command manually
I have the following service unit to back up my project database:
[Unit]
Description=%i mysql backup for `apples` database
After=mysqld.service
Requires=mysqld.service
[Service]
User=root
...
0
votes
1
answer
1k
views
Systemd Timer has no trigger
My systemd timer is configured the following way which should execute its service every 5 minutes.
[Unit]
Description=Sync mail
[Timer]
OnCalendar=*:0/5
Unit=mail.service
[Install]
WantedBy=multi-...
5
votes
2
answers
984
views
How to reset left time of user systemd timer
How can I reset the left time of a user systemd timer?
I have a user systemd service:
[Unit]
Description=Remind to a take break
[Service]
ExecStart=/opt/scripts/break_reminder
Environment=PATH=/sbin:/...
0
votes
1
answer
818
views
systemd-timer: undocumented "AccuracySec=0"
Can anyway tell me where is the document for "AccuracySec=0" of systemd-timer? The most closed document I found is "AccuracySec=1us". I know the meaning of AccuracySec but just ...
0
votes
1
answer
836
views
Multiple Instances of Unit= in Path or Timer Unit?
Can multiple instances of Unit= exist in a systemd.path or systemd.timer unit? Or, must one instead specify multiple instances of the path or timer unit, each with a single instance of Unit=? I ...
0
votes
1
answer
512
views
Should i use default.target or timers.target value for WantedBy for a systemd user timer? [duplicate]
My .timer file located in ~/.config/systemd/user doesn't show in output of systemctl --user list-timers --all command unless i enable it. Is it normal for this command to not show disabled .timers ...