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 (custom user-defined name)

However, in the examples I have found, no further explanation is offered.

The following pages also don't offer any explanation of WantedBy:

I want to understand one simple* method I can use when needed to write a systemd timer instead of a cron job.

* Setting up a cron job is 1 line. Systemd timers involve writing two files and running one or two systemctl commands. But that fact alone is not necessarily what makes systemd timers harder than cron in my experience -- it's the multitude of options and the (seeming) lack of clear documentation with simple examples that are fully explained.

1 Answer 1


For the simple use case, use WantedBy=timers.target. See man systemd.special:


A special target unit that sets up all timer units (see systemd.timer(5) for details) that shall be active after boot.

It is recommended that timer units installed by applications get pulled in via Wants= dependencies from this unit. This is best configured via WantedBy=timers.target in the timer unit's "[Install]" section.

Timers get a dependency of Before=timers.target by default. And, if you check man bootup, you'll see that basic.target pulls in timers.target as a dependency. So I think WantedBy=basic.target would appear to work OK for most cases (same for default.target, which is usually multi-user.target or graphical.target, both of which come after basic.target). But:

timers.target is pulled-in by basic.target asynchronously. This allows timers units to depend on services which become only available later in boot.

So a more complicated timer that depends on some other service unit would be better off depending on timers.target rather than any of the others.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .