-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exit_hook configuration option #10
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,6 +295,19 @@ soa_edit() { | |
fi | ||
} | ||
|
||
exit_hook() { | ||
|
||
if [[ ! -z "${PDNS_EXIT_HOOK:-}" ]]; then | ||
if [[ -x "${PDNS_EXIT_HOOK}" ]]; then | ||
exec ${PDNS_EXIT_HOOK} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^-- SC2086: Double quote to prevent globbing and word splitting. |
||
else | ||
error "Your ${PDNS_EXIT_HOOK} not an executable" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe change this to: |
||
exit 1 | ||
fi | ||
fi | ||
|
||
} | ||
|
||
main() { | ||
# Set hook | ||
hook="$1" | ||
|
@@ -325,6 +338,13 @@ main() { | |
exit 0 | ||
fi | ||
|
||
# Interface for exit_hook | ||
if [[ "${hook}" = "exit_hook" ]]; then | ||
shift | ||
exit_hook $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^-- SC2068: Double quote array expansions to avoid re-splitting elements. |
||
exit 0 | ||
fi | ||
|
||
# Loop through arguments per 3 | ||
for ((i=2; i<=$#; i=i+3)); do | ||
# Setup for this domain | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the white space at the begin/end of the function.