source: ogServer-Git/sources/schedule.h @ 54c7ca3

Last change on this file since 54c7ca3 was 83b242c, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

#942 Add support for scheduled tasks and commands

This field needs to be at least 31 bits long to store all days in a month.
Other fields are also set to 32 bits because unsigned int length can change
depending on the system.

We also need to support the three ways that the ogAdmAgent and the WebConsole?
have to create an schedule. At first, we only supported the easiest
method:

  • Hour, day, month and year -> 10:00, 28, february, 2020

This commit adds these two ways to create an schedule:

  • Hour, week day, month and year -> 10:00, Monday, february, 2020
  • Hour, week, month and year -> 10:00, first week, february, 2020
  • Property mode set to 100644
File size: 893 bytes
RevLine 
[83b242c]1#ifndef _OG_SCHEDULE_H_
2#define _OG_SCHEDULE_H_
3
4#include <stdint.h>
5#include "dbi.h"
6#include "list.h"
7#include <ev.h>
8
9struct og_schedule_time {
10        uint32_t        years;
11        uint32_t        months;
12        uint32_t        weeks;
13        uint32_t        week_days;
14        uint32_t        days;
15        uint32_t        hours;
16        uint32_t        am_pm;
17        uint32_t        minutes;
18};
19
20struct og_schedule {
21        struct list_head        list;
22        struct ev_timer         timer;
23        time_t                  seconds;
24        unsigned int            task_id;
25        unsigned int            schedule_id;
26};
27
28void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
29                        struct og_schedule_time *time);
30void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id,
31                        unsigned int task_id, struct og_schedule_time *time);
32void og_schedule_delete(struct ev_loop *loop, uint32_t schedule_id);
33void og_schedule_next(struct ev_loop *loop);
34void og_schedule_refresh(struct ev_loop *loop);
35void og_dbi_schedule_task(unsigned int task_id);
36
37#endif
Note: See TracBrowser for help on using the repository browser.