Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [systemd-timer]

The tag has no usage guidance.

0
votes
2answers
49 views

How to run systemctl command inside ExecStart?

I am trying to restart all the stale sqlrelay connection services using systemd.timer. Systemd service looks like this: [Unit] Description=sqlrelay-state-connection-restart [Service] Type=oneshot ...
1
vote
0answers
20 views

systemd: Retrying a timer

I'm using borgbackup to back up a few systems. They all use the same borgbackup repository. I have written a systemd timer that starts a backup job using borgmatic. I have an Ansible playbook that ...
1
vote
0answers
40 views

Systemd timer is lost after reboot?

I'm working on Fedora 29 x86_64, fully patched. I have a timer and a service. When the timer fires it starts the service. The service runs a script, and the script exits after about 10 seconds. I can'...
1
vote
0answers
22 views

Systemd timer that runs until success, then enable again the next day

I'm fetching data files from a server owned by someone else. The data files are posted once a day between 6:00 AM and 12:00 Noon. Once I fetch the file for a given day I don't need to check again ...
-1
votes
1answer
71 views

Systemd timer and mount not found

I'm trying to set up a systemd time that runs every 4 hours. When the timer fires a script is run to update some data files. I followed systemd timer every 2 hours at 30 minutes past the hour? and ...
1
vote
3answers
130 views

Systemd timer every minute between 09:15 - 17:15 [duplicate]

i need a service to start every minute between 09:15 - 17:15. Whats the best way to achieve this? I could make 3 timers, one to start (1) the timer (2) which runs the service every minute and one to ...
1
vote
2answers
234 views

Pipe output of script through Exec in systemd service?

So 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 ...
0
votes
0answers
79 views

how to take affect the seting on temporary files ( /tmp )

subject - new settings retarding temporary files ( redhat 7.2 ) we set new values on the following configuration files , in order to minimize /tmp capacity in file: /lib/systemd/system/systemd-...
1
vote
2answers
311 views

How to make systemd timer run exactly every 10 minutes, with a task that lasts slightly longer than that?

I have a rather annoying issue with systemd timers and drifting start time. I had an old cron.d script (which executed faithfully once every 10 minutes) that I'm trying to modernize. The problem is ...
1
vote
1answer
67 views

How to stop a service before executing an ExecStart entry?

I would like to set up a Timer which will stop a service, execute a script and restart the service. One of the possibilities is to use Type=oneshot ExecStartPre=/bin/systemctl stop myservice ...
2
votes
0answers
43 views

Prevent systemd timer to run on a metered connection

I have a systemd timer that runs every 10 minutes to download my email with offlineimap. The problem is that i sometimes get a big amount of mail, or big attachments, and in the meantime i might be ...
1
vote
3answers
80 views

restart systemd service within a timeframe

I have systemd unit file, I know it can be restarted on failure by providing parameters, like : Restart=always RestartSec=90 It will restart after 90 seconds whenever it fails, But, I want to ...
1
vote
1answer
43 views

temporarily override one of two complementary timers

In order to toggle light and dark color schemes, I've set up two units that run a script that creates a symbolic link to my termite configuration file, when triggered by their respective timers. The ...
4
votes
1answer
299 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 ...
3
votes
1answer
159 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?
0
votes
1answer
38 views

Systemd timer run on XX:50

I'm having hard time figure out the format to run every hour on the :50 minute mark. I've tried: OnCalendar=00/0:50 But it Timer unit lacks value setting. Refusing.
1
vote
0answers
43 views

Systemd user timer only runs when logged in [duplicate]

I have as file sync script I want executed periodically every 1 min or so. Since I may need separate instances for different users I run it as a user instead of root. The issue I have is that it seems ...
3
votes
2answers
285 views

Temporarily stop all systemd timer units

I am writing a script that prepares my Linux system for benchmarking. Among other things I want to stop all systemd timer units, and revert this action afterwards. In short, I need the equivalent of ...
1
vote
1answer
160 views

Send email periodically with systemd

I'd like to use systemd timers to send emails periodically to remind me of certain things like anniversaries or filing taxes. I send my regular emails with Mutt; it would be nice if I could reuse ...
0
votes
1answer
205 views

Systemd timer won't start in time

Trying to replace some cron jobs with systemd timers on an ArchLinux installation, I've created a simple timer/service as described here: [Unit] Description=Test timer [Timer] Persistent=false ...
1
vote
1answer
687 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 ...
0
votes
1answer
265 views

Using systemd timer to shut down and start service

I have created a ServiceName.service file. [Unit] Description=ServiceName Service After=network.target [Service] ExecStart=/usr/local/bin/<scriptName>.sh And I have create a ServiceName.timer ...
2
votes
0answers
689 views

How to edit the timer for systemd-tmpfiles-clean?

I'm trying to change the cleanup interval for Apache PrivateTmp files from the default 30 days to 6 hours. I read that to edit the time intervals, I should set up an override file in /etc/tmpfiles.d/...
3
votes
1answer
313 views

Scheduled bash script using systemd timer

I wanted to change my wallpaper periodically and randomly from a folder with pictures. I used the program "feh" and wrote a little script with bash called wallpaperscript.sh: #!/bin/bash files=(/...
0
votes
1answer
223 views

Use systemd-shutdownd schedule

I have multiple Redhat & CentOS 7 servers that are used only during working hours. I am looking into using the systemd-shutdownd service to shut down each machine at 6-30pm on workdays. Systemd ...
3
votes
2answers
1k views

Systemd Timer every minute on specific hours (using a range of values)

I want a script to run minutely, but stop executing it during the nighttime. I tried OnCalendar=*-*-* 05..00:*:00 but that lead to Failed to parse calendar specification, ignoring: *-*-* 05..00:*:...
1
vote
1answer
206 views

Start service on timer start and each N seconds after

I use OnUnitActive property which will run each N secods using last activation time of service as starting point, but i want it always run once when timer started and use 'OnUnitActive' property after....
3
votes
1answer
2k 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 (...
0
votes
2answers
126 views

How to schedule a job as non-root user in CoreOS

I have a script on my CoreOS machine which look like below, that I am using to ssh to multiple nodes from a list and get required details host_det=$(ssh -Ao StrictHostKeyChecking=no -o BatchMode=yes -...
1
vote
1answer
65 views

How to use systemd special units

I was trying to create a simple(ish) way to detect whether my laptop lid was closed and activate i3lock when it is. I know that this can be done through acpid or other methods, but I wanted to learn ...
0
votes
1answer
322 views

Systemd timer starts using 90% CPU randomly

My laptop doesn't send ACPI discharge events reliably, so I created a Systemd timer and service to periodically poll the battery level and decide if the computer should hibernate. However, some random ...
2
votes
1answer
3k 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 ...
4
votes
1answer
225 views

systemd: How to run a job both periodically and once at system shutdown?

I want to run a job periodically (e.g., every 5 minutes), and finally once at system shutdown. Systemd supports timers, which could be used to run a job periodically. It also supports to run a job at ...
4
votes
2answers
173 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
1answer
2k views

Systemd service not working

I am trying to make a service that sends me a notification every 60 minutes, I made a bash script that does this called hourly.sh, I know that it works becuase I can run it just fine with ./hourly.sh, ...
0
votes
1answer
856 views

systemd timer enabled but status is inactive

How can I get the following timer to start automatically? Right now the timer only works if I do systemctl start while-test.timer. Otherwise, eventhough I enabled the timer, it does not start ...
3
votes
2answers
1k views

“systemctl list-timers” shows last executed dates that are far in the future

When I run systemctl list-timers, the last executed dates are far in the future. For example, this is part of the output: $ systemctl list-timers NEXT LEFT ...
2
votes
2answers
1k views

Removing a timer created with “systemd-run --on-calendar”

I've created a systemd job using systemd-run --on-calendar .... Now I'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 when ...
1
vote
1answer
843 views

How to see what command is being run by a systemd .timer file?

As an example, take the phpsessionclean schedule. The cron.d file for this looks like this: 09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; ...
0
votes
1answer
54 views

systemd timer define 1s excute but leak 5s

everyone , I define a foo.timer to excute foo.service every seconds my OS version is centos7u2 #systemctl --version systemd 219 -PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +...
2
votes
1answer
623 views

systemd run unit on success of another

I converted some cron jobs to systemd.timer units and want to send a mail on each job failure and success. The excellent ArchLinux wiki page provides information about this and the setup runs ...
0
votes
1answer
451 views

systemd timer starts immediately

I have a systemd timer: [Unit] Description=My timer Wants=network-online.target After=network-online.target [Timer] OnBootSec=10min OnUnitInactiveSec=10min [Install] WantedBy=timers.target And a ...
1
vote
0answers
71 views

Parse error on systemd timer unit. Is the documentation wrong?

Today I tried to add a systemd timer to run a service at 0100hrs on the 1st Saturday of every month. According to man 7 systemd.timer you can use a pair of full stop characters to specify a range of ...
2
votes
4answers
820 views

Prevent systemd timer from running on startup

I've been migrating my crontabs to systemd's timer units. They all look similar to this: .timer file: [Unit] Description=timer that uses myjob.service [Timer] OnCalendar=*-*-* *:00:00 Unit=myjob....
16
votes
1answer
6k 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 - ...
3
votes
3answers
2k views

How to run a script every 5 seconds only when connected to internet

I have a script that updates my google drive. I made a systemd unit to run this script, and a timer that runs the unit every 10 seconds, which both work. However, when I get disconnected from ...
6
votes
2answers
526 views

Systemd timer that expired while suspended

I have created a systemd user timer that expires daily, i.e. at midnight. The problem is that my computer is normally suspended at night. When I wake it up in the morning, I want the timer to trigger, ...
2
votes
2answers
993 views

Periodically running btrfs-scrub

The btrfs-scrub manpage says: The user is supposed to run it manually or via a periodic system service. The recommended period is a month but could be less. For systemd users how is this ...
12
votes
2answers
6k 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. ...
0
votes
1answer
79 views

Command fails running in Systemd timer script

I have backup script for Mysql that previously ran using CRON without issue. I migrated to using systemd timer. The script starts out deleting the previous weeks files before the copy, using this ...