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:
- https://www.freedesktop.org/software/systemd/man/systemd.timer.html
- https://www.freedesktop.org/software/systemd/man/systemd.time.html
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.