4
0

oncalendar.adoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [#exec-on-calendar]
  2. = Execute on calendar file
  3. NOTE: The feature is currently experimental.
  4. Sometimes you want to schedule an action to run at a specific date and time, like at 2024-02-07 at 15:30. This is technically called "an instant", and OliveTin can watch a file that contains a list of instants for new additions.
  5. [source,yaml]
  6. .`start-server-calendar.yaml`
  7. ----
  8. - 2024-03-08T20:11:45+00:00
  9. - 2024-03-08T20:12:30+00:00
  10. ----
  11. OliveTin will watch this file, and also load it on startup. If an instant is seen that is in the past, it is just ignored. If it is in the future then it is scheduled.
  12. This is how you setup an action to use the calendar file:
  13. [source,yaml]
  14. .`config.yaml`
  15. ----
  16. actions:
  17. - title: start server
  18. shell: echo "Starting Server!"
  19. execOnCalendarFile: start-server-calendar.yaml
  20. ----
  21. You will often want an easy way to schedule actions from the web interface as well, you can do this by creating a separate schedule action that adds an instant to the calendar file.
  22. You can use an argument with `type: datetime` to create a date selector in the web interface, to easily select dates to be added to the calendar file. You will have to add hardcoded timezone to suit your needs, you can see below that "+00:00" is being added to "{{ when }}" to create an instant in the UTC timezone.
  23. [source,yaml]
  24. .`config.yaml`
  25. ----
  26. actions:
  27. - title: Schedule server
  28. shell: echo '- {{ when }}+00:00' >> start-server-calendar.yaml
  29. arguments:
  30. - name: when
  31. title: When?
  32. type: datetime
  33. - title: start server
  34. shell: echo "Starting Server!"
  35. execOnCalendarFile: start-server-calendar.yaml
  36. ----