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 on the road using my phone’s metered connection.

Right now i have a custom script that queries the currently active connection using nmcli and checks if it is a metered one. If so, it doesn’t run offlineimap at all.

My question is, can systemd timers do the same? Something along these lines:

  • I do use a service unit; the timer actually starts a oneshot service. – Gergely Polonkai Nov 21 '18 at 4:21
  • Yes, sorry for not being clear, what I meant was that you'd actually need an additional unit like systemd-networkd-wait-online.service and try to do something like this but you still have to use an external tool (like nmcli) to detect whether the connection via certain interface is metered as afaik you cannot do this systemd-only. That's why I said it's not going to be less complicated. – don_crissti Nov 21 '18 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.