Skip to main content

Questions tagged [systemd-timer]

The tag has no usage guidance.

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 ...
Faheem Mitha's user avatar
  • 35.4k
73 votes
2 answers
108k views

systemd timer every 15 minutes

I'm trying to make a systemd timer that runs every 15 minutes. Right now I have: timer-fifteen.timer: [Unit] Description=15min timer [Timer] OnBootSec=0min OnCalendar=*:*:0,15,30,45 Unit=timer-...
Lily Hahn's user avatar
  • 833
55 votes
1 answer
44k views

Which is the correct way to disable a systemd timer unit?

I've successfully migrated a few of my cron jobs over to systemd. I followed some guides and have taken the standard approach of creating 3 files: myjob.timer - systemd timer unit myjob.service - ...
bitofagoob's user avatar
  • 1,435
36 votes
4 answers
35k views

Is there a way to know when a systemd timer will run next?

I am testing a systemd timer and trying to override its default timeout, but without success. I'm wondering whether there is a way to ask systemd to tell us when the service is going to be run next. ...
Alexis Wilke's user avatar
  • 2,929
15 votes
2 answers
22k views

systemd timer every 2 hours at 30 minutes past the hour?

There are several good references on systemd timers including this one: systemd.time Unfortunately, it still isn't clear to me how to create a timer that will run periodically, but at a specific ...
MountainX's user avatar
  • 18.2k
14 votes
2 answers
15k views

Pipe output of script through Exec in systemd service?

I'm trying to set up a systemd service in order to launch a set of files on a daily basis (different types of journals) from directories based off the date. For example, a todo list for today would be ...
Joshua Ferguson's user avatar
14 votes
1 answer
11k views

I'm writing a systemd timer. What value should I use for WantedBy?

In various examples, I have seen all of these different choices suggested: WantedBy=timers.target WantedBy=multi-user.target WantedBy=basic.target WantedBy=default.target WantedBy=mytimer.target (...
MountainX's user avatar
  • 18.2k
14 votes
1 answer
21k views

systemd.unit `RequiresMountsFor=` vs `ConditionPathIsDirectory=`

I am about to write service that rsync --delete directory /mnt/foo to remote server. However because of --delete option, I'd like to not run it unless /mnt/foo is mounted, as this might result in ...
Grzegorz Wierzowiecki's user avatar
12 votes
3 answers
9k views

Removing a timer created with "systemd-run --on-calendar"

I've created a systemd job using systemd-run --on-calendar .... Now I've replaced it with proper .timer and .service files, but I'm not able to remove the old one. I can stop it and disable it, but ...
Jörg Mäder's user avatar
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 ...
aardbol's user avatar
  • 673
10 votes
1 answer
7k views

Cannot override systemd timer with specific time [duplicate]

I use systemd-cron which creates unit files under /lib/systemd. The unit file for cron-daily.timer has [Timer] OnCalendar=daily This triggers the scripts at midnight. I want them to trigger at 3am ...
Steve's user avatar
  • 480
10 votes
2 answers
4k views

using systemd timers instead of cron

I am on Arch Linux where I am trying to create a systemd timer as a cron alternative for hibernating my laptop on low battery. So I wrote these three files: /etc/systemd/system/battery.service [...
71GA's user avatar
  • 1,176
9 votes
1 answer
3k 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 ...
Zeta.Investigator's user avatar
9 votes
1 answer
7k views

Systemd timer will not fire

I have a timer that is literally this: foobar.service: [Unit] Description=Timer Test Requires=rsyslog.service # rsyslog is an active local service. [Service] Type=simple ExecStart=/usr/bin/...
goldilocks's user avatar
  • 88.1k
9 votes
1 answer
11k views

systemd timer - how to get history of when timer triggered

systemctl status mytimer.timer Tells me since when it is active and when the next trigger is due. How can I get a list of when the timer triggered in the past?
pandita's user avatar
  • 793

15 30 50 per page
1
2 3 4 5
11