schedule_job 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +64 -1
- data/lib/schedule_job/cron.rb +1 -0
- data/lib/schedule_job/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11be78ebaf233db44fee63212623c4e68518fa16c1853df6cb87479f7a6733c9
|
4
|
+
data.tar.gz: a0d22e81142823bc94a5c0c2ee1f69677ffa2bccd536026841308d12bcc1421d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67070c26ee315c66e29833ca42b5cb2aff986b6f2c40110e30cc0e513e5a3429da8a0e7e7c8ea83c39f67bd0e478f5fe912e6b1e021ae54e981693e0cde9ee47
|
7
|
+
data.tar.gz: 1598e6c9a1085a9119307c6511aa8886257e2ee617740e66a6e9377ab876899f4c84469ddf26e65395fafab1e59be90154cd1ee49e29701ebf40cff7f2b74ff3
|
data/README.md
CHANGED
@@ -5,13 +5,76 @@ schedule is a frontend around crontab to add/remove cron jobs from user cron tab
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
```
|
8
|
-
gem install schedule_job
|
8
|
+
~ ❯ gem install schedule_job
|
9
|
+
Fetching schedule_job-1.0.1.gem
|
10
|
+
Successfully installed schedule_job-1.0.1
|
11
|
+
Parsing documentation for schedule_job-1.0.1
|
12
|
+
Installing ri documentation for schedule_job-1.0.1
|
13
|
+
Done installing documentation for schedule_job after 0 seconds
|
9
14
|
```
|
10
15
|
|
11
16
|
## Usage
|
12
17
|
|
18
|
+
Example usage:
|
13
19
|
```
|
20
|
+
~ ❯ schedule -h
|
21
|
+
Usage: schedule [options] command
|
22
|
+
-d, --dryrun Report what would happen but do not install the scheduled job.
|
23
|
+
-l, --list List installed cron jobs.
|
24
|
+
-r, --rm JOB_ID Remove the specified job id as indicated by --list
|
25
|
+
-u, --user USER User that the crontab belongs to.
|
26
|
+
-e, --every DURATION Run command every DURATION units of time.
|
27
|
+
For example:
|
28
|
+
--every 10m # meaning, every 10 minutes
|
29
|
+
--every 5h # meaning, every 5 hours
|
30
|
+
--every 2d # meaning, every 2 days
|
31
|
+
--every 3M # meaning, every 3 months
|
14
32
|
|
33
|
+
-c, --cron CRON Run command on the given cron schedule.
|
34
|
+
For example:
|
35
|
+
--cron "*/5 15 * * 1-5" # meaning, Every 5 minutes, at 3:00 PM, Monday through Friday
|
36
|
+
--cron "0 0/30 8-9 5,20 * ?" # meaning, Every 30 minutes, between 8:00 AM and 9:59 AM, on day 5 and 20 of the month
|
37
|
+
|
38
|
+
~ ❯ schedule -l
|
39
|
+
~ ❯ schedule -d -e 10m backup.sh
|
40
|
+
Scheduling: backup.sh Every 10 minutes
|
41
|
+
Next three runs:
|
42
|
+
1. 2021-11-01 21:40:00 -0500
|
43
|
+
2. 2021-11-01 21:50:00 -0500
|
44
|
+
3. 2021-11-01 22:00:00 -0500
|
45
|
+
~ ❯ schedule -l
|
46
|
+
Jobs
|
47
|
+
1. backup.sh Every 10 minutes
|
48
|
+
~ ❯ crontab -l
|
49
|
+
*/10 * * * * backup.sh
|
50
|
+
|
51
|
+
~ ❯ schedule -e 3M quarterly_backup.sh
|
52
|
+
Scheduling: quarterly_backup.sh At 9:43 PM, on day 1 of the month, every 3 months
|
53
|
+
Next three runs:
|
54
|
+
1. 2022-01-01 21:43:00 -0600
|
55
|
+
2. 2022-04-01 21:43:00 -0500
|
56
|
+
3. 2022-07-01 21:43:00 -0500
|
57
|
+
~ ❯ schedule -l
|
58
|
+
Jobs
|
59
|
+
1. backup.sh Every 10 minutes
|
60
|
+
2. quarterly_backup.sh At 9:43 PM, on day 1 of the month, every 3 months
|
61
|
+
~ ❯ crontab -l
|
62
|
+
*/10 * * * * backup.sh
|
63
|
+
43 21 1 */3 * quarterly_backup.sh
|
64
|
+
|
65
|
+
~ ❯ schedule --dryrun --rm 1
|
66
|
+
Would remove: backup.sh Every 10 minutes
|
67
|
+
~ ❯ schedule --dryrun --rm 2
|
68
|
+
Would remove: quarterly_backup.sh At 9:43 PM, on day 1 of the month, every 3 months
|
69
|
+
~ ❯ schedule --rm 1
|
70
|
+
Removing: backup.sh Every 10 minutes
|
71
|
+
~ ❯ schedule -l
|
72
|
+
Jobs
|
73
|
+
1. quarterly_backup.sh At 9:43 PM, on day 1 of the month, every 3 months
|
74
|
+
~ ❯ schedule --rm 1
|
75
|
+
Removing: quarterly_backup.sh At 9:43 PM, on day 1 of the month, every 3 months
|
76
|
+
~ ❯ schedule -l
|
77
|
+
~ ❯ crontab -l
|
15
78
|
```
|
16
79
|
|
17
80
|
## License
|
data/lib/schedule_job/cron.rb
CHANGED
@@ -111,6 +111,7 @@ module ScheduleJob
|
|
111
111
|
# puts "Installing new cron job: #{job_spec}"
|
112
112
|
|
113
113
|
new_crontab = [read_crontab(@user).strip, job_spec.strip].reject(&:empty?).join("\n")
|
114
|
+
new_crontab << "\n" # add a trailing newline
|
114
115
|
write_crontab(new_crontab)
|
115
116
|
end
|
116
117
|
|
data/lib/schedule_job/version.rb
CHANGED