Skip to content
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

Merged
merged 3 commits into from
Oct 30, 2018
Merged

Allow custom scripts or commands before service start #58

merged 3 commits into from
Oct 30, 2018

Conversation

forana
Copy link
Contributor

@forana forana commented Oct 2, 2018

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.

@migruiz4 migruiz4 self-requested a review October 19, 2018 13:00
Copy link
Contributor

@migruiz4 migruiz4 left a 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

wazuh/config/entrypoint.sh Show resolved Hide resolved
Co-Authored-By: forana <alex@alexforan.com>
Copy link
Contributor

@migruiz4 migruiz4 left a 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

@forana
Copy link
Contributor Author

forana commented Oct 22, 2018

argh, sorry about that. should be fixed now @migruiz4

@migruiz4
Copy link
Contributor

Looks good to me!
Thank you for your contribution @forana.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants