tweek 1.2.1 → 1.2.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 +4 -4
- data/README.md +71 -34
- data/bin/tweek +4 -7
- data/lib/tweek/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 597134731238b0b8b85cff135316ba1583820159
|
4
|
+
data.tar.gz: 5f6817a52a96db1a1cf6fef2ba90657699c637ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c2a6e275f98ec45e9faa64317e75894d41100ccfd6ad746d94eedcf1d81e5123201988182d5f52ee124dd6b9760cec092844286b12b9e43f3fd74d4447e155a
|
7
|
+
data.tar.gz: b074907fdea87694c3f2fd0106f6a3d1ac5aac430c984ae9752a4309c222784cc39d9bdd2f0e70b00b70ef3a4659fe2797800a1a88be070d424d4f643ce1a0bc
|
data/README.md
CHANGED
@@ -19,12 +19,16 @@ user to check obscure settings without actually knowing the commands needed.
|
|
19
19
|
One of the objectives of the Tweek GitHub repository is to serve as a repository for sets
|
20
20
|
of configuration parameters that have been found by the community to be useful in
|
21
21
|
maximizing performance for certain machines and workloads. It is hoped people will submit
|
22
|
-
pull requests to add settings files to the `settings` subdirectory of this project.
|
22
|
+
pull requests to add settings files to the `settings` subdirectory of this project. These
|
23
|
+
can then be referenced directly using URLs, or downloaded locally then edited to suit
|
24
|
+
prior to running.
|
23
25
|
|
24
26
|
## Installation
|
25
27
|
|
26
|
-
Tweek
|
27
|
-
within the last five years or so.
|
28
|
+
Tweek requires use Ruby 1.8.7 or above and so can be used on all Linux systems
|
29
|
+
within the last five years or so.
|
30
|
+
|
31
|
+
When using Ruby 1.8.7 note that using settings file via `https` URLs can be problematic.
|
28
32
|
|
29
33
|
### Do I need to be the 'root' user?
|
30
34
|
|
@@ -49,43 +53,34 @@ successful. You should now be able to type `tweek -?` to see the available optio
|
|
49
53
|
|
50
54
|
## Usage
|
51
55
|
|
52
|
-
Tweek can be used in
|
53
|
-
|
54
|
-
* To check the current system against a default configuration
|
55
|
-
* To create a sample settings file that you can edit manually
|
56
|
-
* To generate a settings file based on the current system configuration
|
57
|
-
* To check the current system configuration against a file of settings.
|
58
|
-
* To set the current system configuration to a file of settings.<br>
|
59
|
-
__NOTE__ this is currently restricted to `sysctl` parameters only. TBD.
|
60
|
-
|
61
|
-
In the first case Tweek uses a built-in set of defaults. To check using these simply run:
|
62
|
-
|
63
|
-
```
|
64
|
-
tweek
|
65
|
-
```
|
56
|
+
Tweek can be used in several ways:
|
66
57
|
|
67
|
-
|
68
|
-
|
58
|
+
* To create a sample settings file that you can edit manually,
|
59
|
+
* To check the current system against a desired configuration embodied in a file of settings,
|
60
|
+
* To set or reset the current system configuration to a file of settings.<br>
|
61
|
+
__NOTE__ set/reset is currently restricted to `sysctl` parameters only. TBD.
|
69
62
|
|
70
|
-
|
71
|
-
|
72
|
-
Use `tweek -s` to show them.
|
63
|
+
The settings file can be local or remote (using a variety of URL formats). It has a simple text format
|
64
|
+
which is fully documented in a sample file that can be generated using `tweek -s`.
|
73
65
|
|
74
66
|
### Output
|
75
67
|
|
76
68
|
The output of Tweek is controlled by the `output` option, which takes the following
|
77
69
|
values (default `1`):
|
78
70
|
|
79
|
-
0. No output, just a return code
|
71
|
+
0. No output, just a return code.<br>
|
72
|
+
Useful when using `pssh` or `mush` to execute on multiple machines.
|
80
73
|
|
81
|
-
1. Summary output only is written to STDERR
|
82
|
-
|
83
|
-
|
74
|
+
1. Summary output only is written to STDERR.<br>
|
75
|
+
It consists of a string of dots (when a parameter is OK) or the letter 'F'
|
76
|
+
(when a parameter doesn't match) or the letter 's'
|
77
|
+
(when a parameter is skipped due to failing a condition check), followed by a summary line.
|
84
78
|
|
85
|
-
2.
|
86
|
-
|
79
|
+
2. The summary is written to STDERR.<br>
|
80
|
+
Only the settings that **didn't** match are written to STDOUT in a form that can be reused as input.
|
87
81
|
|
88
|
-
3.
|
82
|
+
3. The summary is written to STDERR.<br>
|
83
|
+
**All** the settings are written to STDOUT in a form that can be reused as input.
|
89
84
|
|
90
85
|
The latter formats differ slightly depending on whether the utility is operating in query
|
91
86
|
mode, set mode or reset mode. See below.
|
@@ -93,7 +88,7 @@ mode, set mode or reset mode. See below.
|
|
93
88
|
Note that the output is colorized by default. Disable this with `--no-color`.
|
94
89
|
|
95
90
|
* red: a value that doesn't match or conditions that are not met
|
96
|
-
* yellow: expected values
|
91
|
+
* yellow: expected or previous values
|
97
92
|
* green: conditions that are met
|
98
93
|
* bold: emphasis
|
99
94
|
|
@@ -107,16 +102,16 @@ The actions of Tweek are controlled by the `mode` option, which takes the follow
|
|
107
102
|
<dt>query</dt>
|
108
103
|
|
109
104
|
<dd>the settings are checked against the actual values and mismatches are highlighted and
|
110
|
-
noted in a comment with the syntax
|
105
|
+
noted in a comment with the syntax <tt>[expected xxx]</tt></dd>
|
111
106
|
|
112
107
|
<dt>set</dt>
|
113
108
|
|
114
109
|
<dd>the settings are set to the given value, mismatches are highlighted and noted in a
|
115
|
-
trailing comment with the syntax
|
110
|
+
trailing comment with the syntax <tt>[was xxx]</tt></dd>
|
116
111
|
|
117
112
|
<dt>reset</dt>
|
118
113
|
|
119
|
-
<dd>action as above but the settings are taken from the
|
114
|
+
<dd>action as above but the settings are taken from the <tt>[was xxx]</tt> comments</dd>
|
120
115
|
|
121
116
|
</dl>
|
122
117
|
|
@@ -132,7 +127,7 @@ highlighting (using Ruby as the language) makes it very readable.
|
|
132
127
|
### Comments
|
133
128
|
|
134
129
|
Comments are of two sorts:
|
135
|
-
* Inline: after the first
|
130
|
+
* Inline: after the first `#` on any line
|
136
131
|
* Block: Following the Ruby convention these begin with `=begin` and end with `=end`
|
137
132
|
|
138
133
|
### Sections
|
@@ -192,6 +187,48 @@ An example for Redhat 7 is:
|
|
192
187
|
tweek --distro=RedHatEnterpriseServer --distro-ver=7.4 --kernel-ver=3.10.0
|
193
188
|
```
|
194
189
|
|
190
|
+
## Example
|
191
|
+
|
192
|
+
Given the following input file `sysctl.twk`:
|
193
|
+
|
194
|
+
```text
|
195
|
+
# Sample test file
|
196
|
+
|
197
|
+
SYSCTL
|
198
|
+
|
199
|
+
kernel.msgmax = 65536 if k ~> 3.1
|
200
|
+
kernel.shmmax = 4000000000 if k>2.5 # Crazy high!
|
201
|
+
kernel.shmall = 4294967296
|
202
|
+
```
|
203
|
+
|
204
|
+
### Querying Current Values
|
205
|
+
|
206
|
+
Running the command `tweek -o 3 sysctl.twk` produces the following output:
|
207
|
+
|
208
|
+
<a><img src="./query.svg"/></a>
|
209
|
+
|
210
|
+
Note that red denotes conditions that weren't met, or values that differed from the
|
211
|
+
expected ones. Green denotes conditions that were met, and yellow is used to highlight
|
212
|
+
expected values, that are called out in the comments.
|
213
|
+
|
214
|
+
### Setting New Values
|
215
|
+
|
216
|
+
Running the command `tweek -m s -o 3 sysctl.twk` produces the following output:
|
217
|
+
|
218
|
+
<a><img src="./set.svg"/></a>
|
219
|
+
|
220
|
+
Note that colors have the same meaning, but now the previous values (if different) are
|
221
|
+
recorded in yellow. You can save this format for use in `reset` mode, if using
|
222
|
+
redirection the `--no-color` option removes the ANSI escape sequences.
|
223
|
+
|
224
|
+
### Resetting Values
|
225
|
+
|
226
|
+
Running the command `tweek -m r -o 3 <above output>` produces the following output:
|
227
|
+
|
228
|
+
<a><img src="./reset.svg"/></a>
|
229
|
+
|
230
|
+
Note that a value will only be reset if it matches!
|
231
|
+
|
195
232
|
## Development
|
196
233
|
|
197
234
|
Tweek was developed using the gem `bundler`. Ensure you have both this and `rake` installed using:
|
data/bin/tweek
CHANGED
@@ -26,8 +26,8 @@ cflag = true
|
|
26
26
|
distro = nil
|
27
27
|
distro_ver = nil
|
28
28
|
kernel_ver = nil
|
29
|
-
OptionParser.new do |o|
|
30
|
-
o.banner = "Usage: #{$0} [options]
|
29
|
+
optparse = OptionParser.new do |o|
|
30
|
+
o.banner = "Usage: #{$0} [options] settings_files..."
|
31
31
|
o.separator ""
|
32
32
|
o.separator "Check and/or update the system parameters specified in the settings files"
|
33
33
|
o.separator "(If not supplied then built-in samples are used)"
|
@@ -107,11 +107,8 @@ if kernel_ver.nil?
|
|
107
107
|
end
|
108
108
|
cs = Tweek::File.new(distro, distro_ver, kernel_ver, mflag, oflag)
|
109
109
|
if ARGV.empty?
|
110
|
-
|
111
|
-
|
112
|
-
exit 2
|
113
|
-
end
|
114
|
-
fh = File.open(File.expand_path('../../settings/sample.twk',__FILE__))
|
110
|
+
STDERR.puts optparse
|
111
|
+
exit 2
|
115
112
|
else
|
116
113
|
dir = FileUtils.pwd
|
117
114
|
ARGV.each do |file|
|
data/lib/tweek/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|