-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Allow a service to be started and stopped with a given duty cycle during a shift.
Rationale
- avoids having to code a version of duty cycle in each wrapped service
- consolidates more of the "when am I running" concept and configuration into a single place
- can permit sleeping the system more often
Details
- Add new optional fields
WorkForandBreakFortostruct Shift. These are strings in the golangtime.Durationformat; they must either both be empty (which leads to the prior behaviour of running the service throughout the shift) or both be valid durations - if
WorkForandBreakForare specified, then at the start of a shift, the service is run for a period ofWorkForduration and then stopped for a period ofBreakForduration, repeating until the end of the shift - two more new optional fields,
StartWorkandStartBreak, give shell commands to perform at the start of a work period and/or a break period, respectively. If given, these shell commands are executed synchronously before the associated systemd service (if any) is started or stopped - when overlapping shifts are merged, the
WorkFor,BreakFor,StartWork, andStartBreakparameters from the shift with the most recentStarttime are used. - by default, shiftwrap services are still considered to be running while taking a break during a shift, and this prevents shiftwrap from calling the idle handler. This behaviour can be changed by setting the global shiftwrap flag
IdleDuringBreakstotrue. In that case, break periods will be treated identically to periods outside of shifts when deciding whether to call the idle handler. SetupandTakedowncode are still only run at the start and end of a shift, not at transitions between work and break periods.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request