<div dir="ltr">You're right, I misunderstood the purpose the the Requires directive. Thanks for pointing this out, I am seeing the expected behavior in my script after removing it.<div><br></div><div>Alden</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 4, 2019 at 1:43 PM Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">04.03.2019 21:19, Alden Page пишет:<br>
> Hi systemd team,<br>
> <br>
> I'm having some trouble understanding the behavior of a systemd timer I've<br>
> set up in systemd version 219. I have a task that I want to run once per<br>
> week on Sundays at 3:00am UTC. However, as soon as I do `systemctl start<br>
> my_timer.timer`, the task starts no matter what time it is. This is a<br>
<br>
That is what you told it to do.<br>
<br>
> problem for me, because that means that my timer starts every single time I<br>
> recreate my server's virtual machine. After the initial erroneously<br>
> scheduled job has completed successfully, the timer starts behaving<br>
> correctly and runs on Sundays at 3:00am UTC.<br>
> <br>
> Here is how I've set up my timers. This is an excerpt from the script I use<br>
> to bootstrap my VMs:<br>
> <br>
> # Schedule weekly ingest of new data<br>
> cat << EOF > /etc/systemd/system/ingest_upstream.service<br>
> [Unit]<br>
> Description=Load and index image data from upstream.<br>
> [Service]<br>
> ExecStart=/usr/bin/curl -XPOST localhost:8001/task -H "Content-Type:<br>
> application/json" -d '{"model": "image", "action": "INGEST_UPSTREAM"}'<br>
> EOF<br>
> <br>
> cat << EOF > /etc/systemd/system/ingest_upstream.timer<br>
> [Unit]<br>
> Description=Ingest data from upstream every Sunday at 8:00am EST (3:00am<br>
> UTC).<br>
> Requires=ingest_upstream.service<br>
> <br>
<br>
Requires means - when ingest_upstream.timer is started (activated) also<br>
start (activate) units listed here. Which is exactly what happens.<br>
<br>
> [Timer]<br>
> OnCalendar=Sun *-*-* 3:00:00<br>
> Unit=ingest_upstream.service<br>
> <br>
> [Install]<br>
> WantedBy=timers.target<br>
> EOF<br>
> systemctl start ingest_upstream.timer<br>
> <br>
> After `systemctl start`, shouldn't it wait until the next OnCalendar<br>
> interval has passed, particularly since `Persistent=...` is not set?<br>
> <br>
<br>
It (presumably ingest_upstream.timer) does wait; your service is not<br>
activated by timer but by basic systemd unit dependency.<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a></blockquote></div>