minicron 0.7.8 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/minicron/constants.rb +1 -1
- data/lib/minicron/hub/app.rb +2 -2
- data/lib/minicron/hub/db/schema.pg.sql +567 -0
- data/lib/minicron/monitor.rb +7 -5
- data/spec/valid_config.toml +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8beedf57f7517a90ad68fd04abaf1347e5177b0a
|
4
|
+
data.tar.gz: bf0e6d8066735370e60e2d794b71a169b6267576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 279dc982408b2e56f9613a3d66b8da70369fdff48f8301ad30501653120dd038146fc13201c3c7de234612055dcdb93d2651a50689e5a6649314c6d7c63cabad
|
7
|
+
data.tar.gz: 57cb3018551c0c9ad8f5bdb2ff5f3caecadcb94eb2c28b0f08ce61df27ea9ef7a19ad89bb8a57bd21b8d92f6953f439ebdf425e33adc4acf1cf25210bbf29d04
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ Requirements
|
|
78
78
|
These databases are also supported but you will need to manaually install the gems for them
|
79
79
|
|
80
80
|
- MySQL via mysql2 (See [here](https://github.com/brianmario/mysql2#compatibility) for compatability info)
|
81
|
-
-
|
81
|
+
- PostgreSQL via pg (See [here](https://bitbucket.org/ged/ruby-pg/wiki/Home) for compatibility info)
|
82
82
|
|
83
83
|
#### Web Server / Reverse Proxy
|
84
84
|
|
@@ -107,7 +107,7 @@ but I encourage you to give it a try in a non critical environment and help me t
|
|
107
107
|
|
108
108
|
2. On some distributions you may need to install the ````ruby-dev```` and ````build-essential```` packages
|
109
109
|
|
110
|
-
3. To install the latest release (currently 0.7.
|
110
|
+
3. To install the latest release (currently 0.7.9) you can ````gem install minicron````, depending on your ruby setup
|
111
111
|
you may need to run this with ````sudo````
|
112
112
|
|
113
113
|
4. Set your database configuration options in ````/etc/minicron.toml````, you can use the [minicron.toml](https://github.com/jamesrwhite/minicron/blob/master/config/minicron.toml) as a guide on what options are configurable
|
data/lib/minicron/constants.rb
CHANGED
data/lib/minicron/hub/app.rb
CHANGED
@@ -95,9 +95,9 @@ module Minicron::Hub
|
|
95
95
|
def self.setup_db
|
96
96
|
# Configure the database
|
97
97
|
case Minicron.config['database']['type']
|
98
|
-
when
|
98
|
+
when /mysql|postgresql/
|
99
99
|
set :database,
|
100
|
-
:adapter => '
|
100
|
+
:adapter => Minicron.config['database']['type'],
|
101
101
|
:host => Minicron.config['database']['host'],
|
102
102
|
:database => Minicron.config['database']['database'],
|
103
103
|
:username => Minicron.config['database']['username'],
|
@@ -0,0 +1,567 @@
|
|
1
|
+
--
|
2
|
+
-- PostgreSQL database dump
|
3
|
+
--
|
4
|
+
|
5
|
+
SET statement_timeout = 0;
|
6
|
+
SET lock_timeout = 0;
|
7
|
+
SET client_encoding = 'UTF8';
|
8
|
+
SET standard_conforming_strings = on;
|
9
|
+
SET check_function_bodies = false;
|
10
|
+
SET client_min_messages = warning;
|
11
|
+
|
12
|
+
--
|
13
|
+
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
14
|
+
--
|
15
|
+
|
16
|
+
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
17
|
+
|
18
|
+
|
19
|
+
--
|
20
|
+
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
21
|
+
--
|
22
|
+
|
23
|
+
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
24
|
+
|
25
|
+
|
26
|
+
SET search_path = public, pg_catalog;
|
27
|
+
|
28
|
+
SET default_tablespace = '';
|
29
|
+
|
30
|
+
SET default_with_oids = false;
|
31
|
+
|
32
|
+
--
|
33
|
+
-- Name: alerts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
34
|
+
--
|
35
|
+
|
36
|
+
CREATE TABLE alerts (
|
37
|
+
id integer NOT NULL,
|
38
|
+
job_id integer NOT NULL,
|
39
|
+
execution_id integer,
|
40
|
+
schedule_id integer,
|
41
|
+
kind character varying(4) DEFAULT ''::character varying NOT NULL,
|
42
|
+
expected_at timestamp without time zone,
|
43
|
+
medium character varying(9) DEFAULT ''::character varying NOT NULL,
|
44
|
+
sent_at timestamp without time zone NOT NULL
|
45
|
+
);
|
46
|
+
|
47
|
+
|
48
|
+
--
|
49
|
+
-- Name: alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
50
|
+
--
|
51
|
+
|
52
|
+
CREATE SEQUENCE alerts_id_seq
|
53
|
+
START WITH 1
|
54
|
+
INCREMENT BY 1
|
55
|
+
NO MINVALUE
|
56
|
+
NO MAXVALUE
|
57
|
+
CACHE 1;
|
58
|
+
|
59
|
+
|
60
|
+
--
|
61
|
+
-- Name: alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
62
|
+
--
|
63
|
+
|
64
|
+
ALTER SEQUENCE alerts_id_seq OWNED BY alerts.id;
|
65
|
+
|
66
|
+
|
67
|
+
--
|
68
|
+
-- Name: executions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
69
|
+
--
|
70
|
+
|
71
|
+
CREATE TABLE executions (
|
72
|
+
id integer NOT NULL,
|
73
|
+
job_id integer NOT NULL,
|
74
|
+
number integer NOT NULL,
|
75
|
+
created_at timestamp without time zone NOT NULL,
|
76
|
+
started_at timestamp without time zone,
|
77
|
+
finished_at timestamp without time zone,
|
78
|
+
exit_status integer
|
79
|
+
);
|
80
|
+
|
81
|
+
|
82
|
+
--
|
83
|
+
-- Name: executions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
84
|
+
--
|
85
|
+
|
86
|
+
CREATE SEQUENCE executions_id_seq [398/1845]
|
87
|
+
START WITH 1
|
88
|
+
INCREMENT BY 1
|
89
|
+
NO MINVALUE
|
90
|
+
NO MAXVALUE
|
91
|
+
CACHE 1;
|
92
|
+
|
93
|
+
|
94
|
+
--
|
95
|
+
-- Name: executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
96
|
+
--
|
97
|
+
|
98
|
+
ALTER SEQUENCE executions_id_seq OWNED BY executions.id;
|
99
|
+
|
100
|
+
|
101
|
+
--
|
102
|
+
-- Name: hosts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
103
|
+
--
|
104
|
+
|
105
|
+
CREATE TABLE hosts (
|
106
|
+
id integer NOT NULL,
|
107
|
+
name character varying,
|
108
|
+
fqdn character varying DEFAULT ''::character varying NOT NULL,
|
109
|
+
"user" character varying(32) DEFAULT ''::character varying NOT NULL,
|
110
|
+
host character varying DEFAULT ''::character varying NOT NULL,
|
111
|
+
port integer NOT NULL,
|
112
|
+
public_key text,
|
113
|
+
created_at timestamp without time zone NOT NULL,
|
114
|
+
updated_at timestamp without time zone NOT NULL
|
115
|
+
);
|
116
|
+
|
117
|
+
|
118
|
+
--
|
119
|
+
-- Name: hosts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
120
|
+
--
|
121
|
+
|
122
|
+
CREATE SEQUENCE hosts_id_seq
|
123
|
+
START WITH 1
|
124
|
+
INCREMENT BY 1
|
125
|
+
NO MINVALUE
|
126
|
+
NO MAXVALUE
|
127
|
+
CACHE 1;
|
128
|
+
|
129
|
+
|
130
|
+
--
|
131
|
+
-- Name: hosts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
132
|
+
--
|
133
|
+
|
134
|
+
ALTER SEQUENCE hosts_id_seq OWNED BY hosts.id;
|
135
|
+
|
136
|
+
|
137
|
+
--
|
138
|
+
-- Name: job_execution_outputs; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
139
|
+
--
|
140
|
+
|
141
|
+
CREATE TABLE job_execution_outputs (
|
142
|
+
id integer NOT NULL,
|
143
|
+
execution_id integer NOT NULL,
|
144
|
+
seq integer NOT NULL,
|
145
|
+
output text NOT NULL,
|
146
|
+
"timestamp" timestamp without time zone NOT NULL
|
147
|
+
);
|
148
|
+
|
149
|
+
|
150
|
+
--
|
151
|
+
-- Name: job_execution_outputs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
152
|
+
--
|
153
|
+
|
154
|
+
CREATE SEQUENCE job_execution_outputs_id_seq
|
155
|
+
START WITH 1
|
156
|
+
INCREMENT BY 1
|
157
|
+
NO MINVALUE
|
158
|
+
NO MAXVALUE
|
159
|
+
CACHE 1;
|
160
|
+
|
161
|
+
|
162
|
+
--
|
163
|
+
-- Name: job_execution_outputs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
164
|
+
--
|
165
|
+
|
166
|
+
ALTER SEQUENCE job_execution_outputs_id_seq OWNED BY job_execution_outputs.id;
|
167
|
+
|
168
|
+
|
169
|
+
--
|
170
|
+
-- Name: jobs; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
171
|
+
--
|
172
|
+
|
173
|
+
CREATE TABLE jobs (
|
174
|
+
id integer NOT NULL,
|
175
|
+
host_id integer NOT NULL,
|
176
|
+
job_hash character varying(32) DEFAULT ''::character varying NOT NULL,
|
177
|
+
name character varying,
|
178
|
+
"user" character varying(32) NOT NULL,
|
179
|
+
command text NOT NULL,
|
180
|
+
created_at timestamp without time zone NOT NULL,
|
181
|
+
updated_at timestamp without time zone NOT NULL
|
182
|
+
);
|
183
|
+
|
184
|
+
|
185
|
+
--
|
186
|
+
-- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
187
|
+
--
|
188
|
+
|
189
|
+
CREATE SEQUENCE jobs_id_seq
|
190
|
+
START WITH 1
|
191
|
+
INCREMENT BY 1
|
192
|
+
NO MINVALUE
|
193
|
+
NO MAXVALUE
|
194
|
+
CACHE 1;
|
195
|
+
|
196
|
+
|
197
|
+
--
|
198
|
+
-- Name: jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
199
|
+
--
|
200
|
+
|
201
|
+
ALTER SEQUENCE jobs_id_seq OWNED BY jobs.id;
|
202
|
+
|
203
|
+
|
204
|
+
--
|
205
|
+
-- Name: schedules; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
206
|
+
--
|
207
|
+
|
208
|
+
CREATE TABLE schedules (
|
209
|
+
id integer NOT NULL,
|
210
|
+
job_id integer NOT NULL,
|
211
|
+
minute character varying(169),
|
212
|
+
hour character varying(61),
|
213
|
+
day_of_the_month character varying(83),
|
214
|
+
month character varying(26),
|
215
|
+
day_of_the_week character varying(13),
|
216
|
+
special character varying(9),
|
217
|
+
created_at timestamp without time zone NOT NULL,
|
218
|
+
updated_at timestamp without time zone NOT NULL
|
219
|
+
);
|
220
|
+
|
221
|
+
--
|
222
|
+
-- Name: schedules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
223
|
+
--
|
224
|
+
|
225
|
+
CREATE SEQUENCE schedules_id_seq
|
226
|
+
START WITH 1
|
227
|
+
INCREMENT BY 1
|
228
|
+
NO MINVALUE
|
229
|
+
NO MAXVALUE
|
230
|
+
CACHE 1;
|
231
|
+
|
232
|
+
|
233
|
+
--
|
234
|
+
-- Name: schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
235
|
+
--
|
236
|
+
|
237
|
+
ALTER SEQUENCE schedules_id_seq OWNED BY schedules.id;
|
238
|
+
|
239
|
+
|
240
|
+
--
|
241
|
+
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
242
|
+
--
|
243
|
+
|
244
|
+
CREATE TABLE schema_migrations (
|
245
|
+
version character varying NOT NULL
|
246
|
+
);
|
247
|
+
|
248
|
+
|
249
|
+
--
|
250
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
251
|
+
--
|
252
|
+
|
253
|
+
ALTER TABLE ONLY alerts ALTER COLUMN id SET DEFAULT nextval('alerts_id_seq'::regclass);
|
254
|
+
|
255
|
+
|
256
|
+
--
|
257
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
258
|
+
--
|
259
|
+
|
260
|
+
ALTER TABLE ONLY executions ALTER COLUMN id SET DEFAULT nextval('executions_id_seq'::regclass);
|
261
|
+
|
262
|
+
|
263
|
+
--
|
264
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
265
|
+
--
|
266
|
+
|
267
|
+
ALTER TABLE ONLY hosts ALTER COLUMN id SET DEFAULT nextval('hosts_id_seq'::regclass);
|
268
|
+
|
269
|
+
|
270
|
+
--
|
271
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
272
|
+
--
|
273
|
+
|
274
|
+
ALTER TABLE ONLY job_execution_outputs ALTER COLUMN id SET DEFAULT nextval('job_execution_outputs_id_seq'::regclass);
|
275
|
+
|
276
|
+
|
277
|
+
--
|
278
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
279
|
+
--
|
280
|
+
|
281
|
+
ALTER TABLE ONLY jobs ALTER COLUMN id SET DEFAULT nextval('jobs_id_seq'::regclass);
|
282
|
+
|
283
|
+
|
284
|
+
--
|
285
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
286
|
+
--
|
287
|
+
|
288
|
+
ALTER TABLE ONLY schedules ALTER COLUMN id SET DEFAULT nextval('schedules_id_seq'::regclass);
|
289
|
+
|
290
|
+
|
291
|
+
--
|
292
|
+
-- Name: alerts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
293
|
+
--
|
294
|
+
|
295
|
+
SELECT pg_catalog.setval('alerts_id_seq', 1, false);
|
296
|
+
|
297
|
+
|
298
|
+
--
|
299
|
+
-- Name: executions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
300
|
+
--
|
301
|
+
|
302
|
+
SELECT pg_catalog.setval('executions_id_seq', 1, false);
|
303
|
+
|
304
|
+
|
305
|
+
--
|
306
|
+
-- Name: hosts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
307
|
+
--
|
308
|
+
|
309
|
+
SELECT pg_catalog.setval('hosts_id_seq', 1, false);
|
310
|
+
|
311
|
+
|
312
|
+
--
|
313
|
+
-- Name: job_execution_outputs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
314
|
+
--
|
315
|
+
|
316
|
+
SELECT pg_catalog.setval('job_execution_outputs_id_seq', 1, false);
|
317
|
+
|
318
|
+
|
319
|
+
--
|
320
|
+
-- Name: jobs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
321
|
+
--
|
322
|
+
|
323
|
+
SELECT pg_catalog.setval('jobs_id_seq', 1, false);
|
324
|
+
|
325
|
+
|
326
|
+
--
|
327
|
+
-- Name: schedules_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
328
|
+
--
|
329
|
+
|
330
|
+
SELECT pg_catalog.setval('schedules_id_seq', 1, false);
|
331
|
+
|
332
|
+
|
333
|
+
--
|
334
|
+
-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: -
|
335
|
+
--
|
336
|
+
|
337
|
+
COPY schema_migrations (version) FROM stdin;
|
338
|
+
0
|
339
|
+
\.
|
340
|
+
|
341
|
+
|
342
|
+
--
|
343
|
+
-- Name: alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
344
|
+
--
|
345
|
+
|
346
|
+
ALTER TABLE ONLY alerts
|
347
|
+
ADD CONSTRAINT alerts_pkey PRIMARY KEY (id);
|
348
|
+
|
349
|
+
|
350
|
+
--
|
351
|
+
-- Name: executions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
352
|
+
--
|
353
|
+
|
354
|
+
ALTER TABLE ONLY executions
|
355
|
+
ADD CONSTRAINT executions_pkey PRIMARY KEY (id);
|
356
|
+
|
357
|
+
|
358
|
+
--
|
359
|
+
-- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
360
|
+
--
|
361
|
+
|
362
|
+
ALTER TABLE ONLY hosts
|
363
|
+
ADD CONSTRAINT hosts_pkey PRIMARY KEY (id);
|
364
|
+
|
365
|
+
|
366
|
+
--
|
367
|
+
-- Name: job_execution_outputs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
368
|
+
--
|
369
|
+
|
370
|
+
ALTER TABLE ONLY job_execution_outputs
|
371
|
+
ADD CONSTRAINT job_execution_outputs_pkey PRIMARY KEY (id);
|
372
|
+
|
373
|
+
|
374
|
+
--
|
375
|
+
-- Name: jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
376
|
+
--
|
377
|
+
|
378
|
+
ALTER TABLE ONLY jobs
|
379
|
+
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);
|
380
|
+
|
381
|
+
|
382
|
+
--
|
383
|
+
-- Name: schedules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
384
|
+
--
|
385
|
+
|
386
|
+
ALTER TABLE ONLY schedules
|
387
|
+
ADD CONSTRAINT schedules_pkey PRIMARY KEY (id);
|
388
|
+
|
389
|
+
|
390
|
+
--
|
391
|
+
-- Name: alerts_execution_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
392
|
+
--
|
393
|
+
|
394
|
+
CREATE INDEX alerts_execution_id ON alerts USING btree (execution_id);
|
395
|
+
|
396
|
+
|
397
|
+
--
|
398
|
+
-- Name: alerts_job_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
399
|
+
--
|
400
|
+
|
401
|
+
CREATE INDEX alerts_job_id ON alerts USING btree (job_id);
|
402
|
+
|
403
|
+
|
404
|
+
--
|
405
|
+
-- Name: day_of_the_month; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
406
|
+
--
|
407
|
+
|
408
|
+
CREATE INDEX day_of_the_month ON schedules USING btree (day_of_the_month);
|
409
|
+
|
410
|
+
|
411
|
+
--
|
412
|
+
-- Name: day_of_the_week; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
413
|
+
--
|
414
|
+
|
415
|
+
CREATE INDEX day_of_the_week ON schedules USING btree (day_of_the_week);
|
416
|
+
|
417
|
+
|
418
|
+
--
|
419
|
+
-- Name: executions_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
420
|
+
--
|
421
|
+
|
422
|
+
CREATE INDEX executions_created_at ON executions USING btree (created_at);
|
423
|
+
|
424
|
+
|
425
|
+
--
|
426
|
+
-- Name: executions_job_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
427
|
+
--
|
428
|
+
|
429
|
+
CREATE INDEX executions_job_id ON executions USING btree (job_id);
|
430
|
+
|
431
|
+
|
432
|
+
--
|
433
|
+
-- Name: expected_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
434
|
+
--
|
435
|
+
|
436
|
+
CREATE INDEX expected_at ON alerts USING btree (expected_at);
|
437
|
+
|
438
|
+
|
439
|
+
--
|
440
|
+
-- Name: finished_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
441
|
+
--
|
442
|
+
|
443
|
+
CREATE INDEX finished_at ON executions USING btree (finished_at);
|
444
|
+
|
445
|
+
|
446
|
+
--
|
447
|
+
-- Name: host_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
448
|
+
--
|
449
|
+
|
450
|
+
CREATE INDEX host_id ON jobs USING btree (host_id);
|
451
|
+
|
452
|
+
|
453
|
+
--
|
454
|
+
-- Name: hostname; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
455
|
+
--
|
456
|
+
|
457
|
+
CREATE INDEX hostname ON hosts USING btree (fqdn);
|
458
|
+
|
459
|
+
|
460
|
+
--
|
461
|
+
-- Name: hour; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
462
|
+
--
|
463
|
+
|
464
|
+
CREATE INDEX hour ON schedules USING btree (hour);
|
465
|
+
|
466
|
+
|
467
|
+
--
|
468
|
+
-- Name: job_execution_outputs_execution_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
469
|
+
--
|
470
|
+
|
471
|
+
CREATE INDEX job_execution_outputs_execution_id ON job_execution_outputs USING btree (execution_id);
|
472
|
+
|
473
|
+
|
474
|
+
--
|
475
|
+
-- Name: job_hash; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
476
|
+
--
|
477
|
+
|
478
|
+
CREATE UNIQUE INDEX job_hash ON jobs USING btree (job_hash);
|
479
|
+
|
480
|
+
|
481
|
+
--
|
482
|
+
-- Name: jobs_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
483
|
+
--
|
484
|
+
|
485
|
+
CREATE INDEX jobs_created_at ON jobs USING btree (created_at);
|
486
|
+
|
487
|
+
|
488
|
+
--
|
489
|
+
-- Name: kind; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
490
|
+
--
|
491
|
+
|
492
|
+
CREATE INDEX kind ON alerts USING btree (kind);
|
493
|
+
|
494
|
+
|
495
|
+
--
|
496
|
+
-- Name: medium; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
497
|
+
--
|
498
|
+
|
499
|
+
CREATE INDEX medium ON alerts USING btree (medium);
|
500
|
+
|
501
|
+
|
502
|
+
--
|
503
|
+
-- Name: minute; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
504
|
+
--
|
505
|
+
|
506
|
+
CREATE INDEX minute ON schedules USING btree (minute);
|
507
|
+
|
508
|
+
|
509
|
+
--
|
510
|
+
-- Name: month; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
511
|
+
--
|
512
|
+
|
513
|
+
CREATE INDEX month ON schedules USING btree (month);
|
514
|
+
|
515
|
+
|
516
|
+
--
|
517
|
+
-- Name: schedule_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
518
|
+
--
|
519
|
+
|
520
|
+
CREATE INDEX schedule_id ON alerts USING btree (schedule_id);
|
521
|
+
|
522
|
+
|
523
|
+
--
|
524
|
+
-- Name: schedules_job_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
525
|
+
--
|
526
|
+
|
527
|
+
CREATE INDEX schedules_job_id ON schedules USING btree (job_id);
|
528
|
+
|
529
|
+
|
530
|
+
--
|
531
|
+
-- Name: seq; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
532
|
+
--
|
533
|
+
|
534
|
+
CREATE INDEX seq ON job_execution_outputs USING btree (seq);
|
535
|
+
|
536
|
+
|
537
|
+
--
|
538
|
+
-- Name: special; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
539
|
+
--
|
540
|
+
|
541
|
+
CREATE INDEX special ON schedules USING btree (special);
|
542
|
+
|
543
|
+
|
544
|
+
--
|
545
|
+
-- Name: started_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
546
|
+
--
|
547
|
+
|
548
|
+
CREATE INDEX started_at ON executions USING btree (started_at);
|
549
|
+
|
550
|
+
|
551
|
+
--
|
552
|
+
-- Name: unique_number_per_job; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
553
|
+
--
|
554
|
+
|
555
|
+
CREATE UNIQUE INDEX unique_number_per_job ON executions USING btree (job_id, number);
|
556
|
+
|
557
|
+
|
558
|
+
--
|
559
|
+
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
560
|
+
--
|
561
|
+
|
562
|
+
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
|
563
|
+
|
564
|
+
|
565
|
+
--
|
566
|
+
-- PostgreSQL database dump complete
|
567
|
+
--
|
data/lib/minicron/monitor.rb
CHANGED
@@ -17,10 +17,10 @@ module Minicron
|
|
17
17
|
# Establishes a database connection
|
18
18
|
def setup_db
|
19
19
|
case Minicron.config['database']['type']
|
20
|
-
when
|
20
|
+
when /mysql|postgres/
|
21
21
|
# Establish a database connection
|
22
22
|
ActiveRecord::Base.establish_connection(
|
23
|
-
:adapter => '
|
23
|
+
:adapter => Minicron.config['database']['type'],
|
24
24
|
:host => Minicron.config['database']['host'],
|
25
25
|
:database => Minicron.config['database']['database'],
|
26
26
|
:username => Minicron.config['database']['username'],
|
@@ -103,9 +103,11 @@ module Minicron
|
|
103
103
|
# Parse the cron expression
|
104
104
|
cron = CronParser.new(schedule.formatted)
|
105
105
|
|
106
|
-
# Find the time the cron was last expected to run
|
107
|
-
|
108
|
-
|
106
|
+
# Find the time the cron was last expected to run with a 30 second pre buffer
|
107
|
+
# and a 30 second post buffer (in addition to the 60 already in place) incase
|
108
|
+
# jobs run early/late to allow for clock sync differences between client/hub
|
109
|
+
expected_at = cron.last(Time.now) - 30
|
110
|
+
expected_by = expected_at + 30 + 60 + 30 # pre buffer + minute wait + post buffer
|
109
111
|
|
110
112
|
# We only need to check jobs that are expected to under the monitor start time
|
111
113
|
# and jobs that have passed their expected by time and the time the schedule
|
data/spec/valid_config.toml
CHANGED
@@ -24,8 +24,8 @@ cron_file = "/etc/crontab"
|
|
24
24
|
|
25
25
|
# Database options
|
26
26
|
[database]
|
27
|
-
type = "sqlite" # [mysql, sqlite]
|
28
|
-
# The options below are for mysql only
|
27
|
+
type = "sqlite" # [mysql, postgresql, sqlite]
|
28
|
+
# The options below are for mysql and postgresql only
|
29
29
|
# host = "127.0.0.1"
|
30
30
|
# database = "minicron"
|
31
31
|
# username = "minicron"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minicron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James White
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -615,6 +615,7 @@ files:
|
|
615
615
|
- lib/minicron/hub/controllers/api/jobs.rb
|
616
616
|
- lib/minicron/hub/controllers/api/schedule.rb
|
617
617
|
- lib/minicron/hub/controllers/index.rb
|
618
|
+
- lib/minicron/hub/db/schema.pg.sql
|
618
619
|
- lib/minicron/hub/db/schema.rb
|
619
620
|
- lib/minicron/hub/db/schema.sql
|
620
621
|
- lib/minicron/hub/models/alert.rb
|
@@ -684,7 +685,7 @@ requirements:
|
|
684
685
|
- ruby-dev (you may need this to be able to install eventmachine)
|
685
686
|
- build-essential (you may need this to be able to install eventmachine)
|
686
687
|
rubyforge_project:
|
687
|
-
rubygems_version: 2.
|
688
|
+
rubygems_version: 2.4.3
|
688
689
|
signing_key:
|
689
690
|
specification_version: 4
|
690
691
|
summary: A system to make it easier to manage and monitor cron jobs
|