fileminer 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93670c0973d05575fdab215da684c633c9367f2288168cecab359b0464c539de
4
- data.tar.gz: 55eaa5c573e308585da35ec30423988c049ef25669ea161a069a5c3392d75ee5
3
+ metadata.gz: '0480c78fcf49be0ff2ebc29d2993bc45852daec6e8cfd96568a68f515d52845c'
4
+ data.tar.gz: 39cd25174e8e6dc8eab9aca064ec0bcd9a2ba86e69432543e10bda02a20a2fc7
5
5
  SHA512:
6
- metadata.gz: 3786c83518c206f3a1bec0ed6b13ce46f3c1604655be8a2d48afa66e8bf202d40fb3bbda5c4c3521e5bbd7265ce7773fa114f03520f162876f6a19ce7ca0c474
7
- data.tar.gz: 729cba5d996c05301a8ed4870180f89f74511b0709d96c666df43ba7755d17c4a56d5531f19d98e5180029ff8283268671a4ed258582dc8ef0d437d34d22272a
6
+ metadata.gz: d2e9dc70729d14f0fa35774d33b34420516ca0fa82a5bbc3d0c2fdf531292d621c3d2def2a2ca77fa890ef5d255cdde0c29d5c673fa0e7a22834df03bdd5b541
7
+ data.tar.gz: 01d0d80f2ac6462ae99d6decb6c1d752be5d6905081bc1448051bf0afe9940ec5967eb3e19cf41fa4fd0be36ab12674e7f26a8f5843592a34267f0e463514577
@@ -67,6 +67,39 @@ user=root
67
67
  end
68
68
  end
69
69
 
70
+ def gen_systemd_conf(options)
71
+ wrapper_home = File.join ENV['GEM_HOME'], 'wrappers'
72
+ content = <<-EOS
73
+ [Unit]
74
+ Description=FileMiner Service
75
+ After=network.target
76
+
77
+ [Service]
78
+ Type=simple
79
+ PIDFile=/run/fileminer.pid
80
+ SuccessExitStatus=0
81
+ KillSignal=SIGINT
82
+ ExecStart=#{wrapper_home}/fileminer
83
+ User=root
84
+ Restart=on-abort
85
+
86
+ [Install]
87
+ WantedBy=multi-user.target
88
+ EOS
89
+ if options.key? :out
90
+ out = options[:out]
91
+ dst = out.nil? ? '/usr/lib/systemd/system/fileminer.service' : File.absolute_path(out)
92
+ unless dst.end_with?('.service')
93
+ dst = File.join dst, 'fileminer.service'
94
+ end
95
+ dst_dir = File.dirname dst
96
+ Dir.mkdirs dst_dir unless Dir.exists? dst_dir
97
+ File.open(dst, 'w') { |io| io.write content }
98
+ else
99
+ puts content
100
+ end
101
+ end
102
+
70
103
 
71
104
  options = Hash.new
72
105
  OptionParser.new do |opts|
@@ -78,6 +111,8 @@ OptionParser.new do |opts|
78
111
  opts.separator ' fileminer-genconf -t fileminer -o Generate config on /etc/fileminer/fileminer.yml'
79
112
  opts.separator ' fileminer-genconf -t supervisor -o -l Generate ./fileminer.ini with logfile on'
80
113
  opts.separator ' /var/log/fileminer/stderr.log'
114
+ opts.separator ' fileminer-genconf -t systemd -o Generate systemd config on'
115
+ opts.separator ' /usr/lib/systemd/system/fileminer.service'
81
116
  opts.separator ''
82
117
  opts.separator 'Options:'
83
118
 
@@ -90,7 +125,7 @@ OptionParser.new do |opts|
90
125
 
91
126
  # type
92
127
  options[:type] = :fileminer
93
- opts.on('-t', '--type fileminer|supervisor', [:fileminer, :supervisor],
128
+ opts.on('-t', '--type fileminer|supervisor|systemd', [:fileminer, :supervisor, :systemd],
94
129
  'Type of the config file to be generated', 'Default is fileminer') do |value|
95
130
  options[:type] = value
96
131
  end
@@ -117,4 +152,6 @@ when :fileminer
117
152
  gen_fileminer_conf options
118
153
  when :supervisor
119
154
  gen_supervisor_conf options
155
+ when :systemd
156
+ gen_systemd_conf options
120
157
  end
@@ -1,5 +1,5 @@
1
1
  class FileMiner
2
2
 
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fileminer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fang MinJie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-12-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  FileMiner is a simple file/log transfer tool implemented in Ruby.