-
Notifications
You must be signed in to change notification settings - Fork 386
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
Allow custom scripts or commands before service start #58
Conversation
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.
Hi @forana
I have tested it and works perfectly. Great job.
The only modification I think this needs, is printing some extra information about what commands are being executed, to make it more visible in the docker logs, for example adding the following code.
This change would make the output look like this:
wazuh_1 | Executing command `echo hello world`:
wazuh_1 | hello world
wazuh_1 | Executing command: `ls /var/ossec/`:
wazuh_1 | api
wazuh_1 | api-template
wazuh_1 | backup
wazuh_1 | bin
wazuh_1 | data
wazuh_1 | etc
wazuh_1 | etc-template
wazuh_1 | framework
wazuh_1 | integrations
wazuh_1 | lib
wazuh_1 | logs
wazuh_1 | logs-template
wazuh_1 | queue
wazuh_1 | queue-template
wazuh_1 | ruleset
wazuh_1 | ruleset-template
wazuh_1 | stats
wazuh_1 | stats-template
wazuh_1 | tmp
wazuh_1 | var
wazuh_1 | wodles
Thank you very much for developing this new feature.
We appreciate all the contributions that help us improve our code.
Best regards,
Miguel
Co-Authored-By: forana <alex@alexforan.com>
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.
Hi @forana,
Thank you for applying the changes so quickly, but while reviewing again the entrypoint.sh, I realized now it looks like this:
for CUSTOM_COMMAND in "$@"
do
echo "Executing command \`${CUSTOM_COMMAND}\`"
exec_cmd_stdout "${CUSTOM_COMMAND}"
done
exec_cmd_stdout "${CUSTOM_COMMAND}"
done
Can you please fix that little issue?
Regards,
Miguel
argh, sorry about that. should be fixed now @migruiz4 |
Looks good to me! |
Addresses #57
This method is arguably only slightly less hacky than the two workarounds I added in #57, but it's a sounder strategy for automated installation than either of them.