schedule_job 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc056eaeb082429537d01a7521bef0574cecc73a8dc8baa769a02a271758aa86
4
- data.tar.gz: 654b25fe20451949bbecc43b3757bdba36898ed1e40a4f50d9943828e2a2951f
3
+ metadata.gz: 11be78ebaf233db44fee63212623c4e68518fa16c1853df6cb87479f7a6733c9
4
+ data.tar.gz: a0d22e81142823bc94a5c0c2ee1f69677ffa2bccd536026841308d12bcc1421d
5
5
  SHA512:
6
- metadata.gz: c5f49020d6b8965598eba15614cfdfb700ef383c58787c6b72de53f795d36c026bb6a2913905372ecf51b1e7136b3fc0be2430579d3e8ee0d17cd71a1e45b61b
7
- data.tar.gz: 8f139bdc6d8d6edb8e6780e304e431fa8141c05089d05bbce062afab6dac42db3b94c546ab556d6a962cb9a4285e83a8c7ef7e10a65fe57972e2895263cf89f5
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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module ScheduleJob
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schedule_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis