The custom web application My App, in addition to its web server request-driven work, has three daemons (able, baker and charlie) and three jobs (dog, easy and fox) that run (cron-like) on a pre-defined schedule.
The app needs these all to be in one of two states
State | description |
---|---|
Up | all the daemons are running and the jobs run according to their respective schedules |
Down | all daemons are stopped and the jobs do not run |
We want to use systemd to
- enforce this Up/Down policy,
- give the operator (and scripts etc.) a means to switch between Up and Down states, and
- start the daemons and jobs at an appropriate stage of system startup (in this case that is not before the local MariaDB database service is up).
- Install a custom systemd target unit
myapp_master.target
on which to usesystemctl
commands - Use one service unit to mange each of the daemons
- For each job, use a systemd timer unit, each with a corresponding service unit to run the job
- Make the daemon service and timer units depend on the master target
See the unit files for details.