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

Add sorting for startup files #153

Merged
merged 2 commits into from
Mar 18, 2020
Merged

Conversation

anatolinicolae
Copy link
Contributor

@anatolinicolae anatolinicolae commented Jan 29, 2020

Alphanumerically sort files found in /startup.1.d and /startup.2.d directories, to prevent non regular script execution.

Not sorting whatever find finds, ends up in a messy script execution order like so:

# find -L /startup.1.d -type f -iname '*.sh'
/startup.1.d/050-fix-permissions.sh
/startup.1.d/100-start-scheduler.sh
/startup.1.d/010-copy-app-files.sh
/startup.1.d/011-link-history-docs.sh
/startup.1.d/020-copy-config-files.sh
/startup.1.d/030-add-opcache-dashboard.sh
/startup.1.d/031-add-phpinfo.sh

Piping find's output to sort -n actually fixes the order resulting in what we're actually expecting the execution order to be:

# find -L /startup.1.d -type f -iname '*.sh' | sort -n
/startup.1.d/010-copy-app-files.sh
/startup.1.d/011-link-history-docs.sh
/startup.1.d/020-copy-config-files.sh
/startup.1.d/030-add-opcache-dashboard.sh
/startup.1.d/031-add-phpinfo.sh
/startup.1.d/050-fix-permissions.sh
/startup.1.d/100-start-scheduler.sh

Alphanumerically sort files found in /startup.1.d and /startup.2.d directories, to prevent non regular script execution.

Signed-off-by: Anatoli Nicolae <[email protected]>
@cytopia cytopia self-assigned this Mar 18, 2020
Copy link
Member

@cytopia cytopia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@cytopia cytopia merged commit 186bf71 into devilbox:master Mar 18, 2020
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.

2 participants