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

Feature: Batch commands #15

Open
pixelchutes opened this issue May 23, 2017 · 4 comments
Open

Feature: Batch commands #15

pixelchutes opened this issue May 23, 2017 · 4 comments
Labels

Comments

@pixelchutes
Copy link

With some minor bash scripting, it shouldn't be too difficult to create a loop of each configured instance, mapping a subsequent call to system:clearcache to each.

It would be even cooler + easier if there was a built in batch command to clear all caches from the tool itself.

@rtripault
Copy link
Member

Agreed, but it should not limited to clearing cache. We should be able a single against multiple/all instances.

But i'm not sure how to handle failures in those situations...

@pixelchutes
Copy link
Author

pixelchutes commented May 24, 2017

Certainly! Batching in general would be awesome to extend to the other commands, where appropriate.

Here's a simple proof of concept for batching "MODX Version" (unnecessary, I know -- just a simple/safe command I used for testing)

modx config:list | tail -n +4 | grep "|" | awk -F" " '{ system("modx version -s"$2"") }'

@rtripault
Copy link
Member

rtripault commented May 24, 2017

Thanks for putting that out here!

After leaving that idea grow, i guess i could come up with a "batch" command that would execute any sub command...

modx batch {command} would run {command} on all defined/configured instances

modx batch {command} --instance name1 --instance name2 would run command on name1 & name2 instances, according they exist...

Does that sound like a good idea ?

Edit : i guess this also brings the need to enable commands to be "batcheable". It does not make sense to "batch install" for example.

I also forgot to handle command arguments/options so far...

@pixelchutes
Copy link
Author

pixelchutes commented May 26, 2017

@rtripault that is awesome! Exactly the line of thinking I had, since -- in some cases -- you'd definitely need the ability to only target a handful of instances.

Agreed, some things should not be "batchable." Let me know if there's anything I can do to assist. e.g. Testing, at the very least.

EDIT: I'm not sure what would be easiest in terms of flagging a command in support of batch (opt in vs. opt out approach.)

@pixelchutes pixelchutes changed the title Feature: Batch clear cache Feature: Batch commands May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants