Necessary improvements to the shell code #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code for the following files has been changed:
The above files share common logic and the following changes have been made in them all:
dig
command has been moved as the first step to improvise the logic. The request has to be made irrespect of the further logic in the script.dig
command has been stored in a memory variable. This reduces 2 disk access requests - one to create and write in it the first time, and the second to compare it with the existing file containing the ip addresses.diff
command has been modified to compare the memory variable with the existing file containing the ip addresses.Reason: By keeping the variable in the memory improves the script execution time. Disk access should be kept to minimum.
The
README.md
file has been modified to add more details.PS: I am an ex-PagerDuty employee. Do not have Pull Request permissions on the branch anymore. Choose to create a fork and then merge the code. Thanks.