Distillery - what's the difference between command and hooks?

Hi.

I am using Distillery and i am struggling to understand the difference between a command an hook. They both seem to do similar things (maybe hooks just give you control over when they happen).

Can anyone break it down into laymans terms for this simple mind and maybe what you would use them for?

Cheers.

I have figured this out - teaches me a lesson for glossing over the documentation.

I thought commands were automatically executed on deployment, but that is not correct.

Commands can be run from release build
Hooks are run automatically at certain stages of the app lifecycle

Makes sense now. I think I like the idea of migrating my database in hooks rather than running a command on the server… personal preference / use case specific I suppose.

1 Like

Its more about the use case rather than preference.

Sometimes there are tasks that are not related to deployment but needs to be run on a regular basis. Just lets take a small game where you need to calculate leadership boards daily.

You can write a command to do so and trigger this by cron/systemd at midnight.

Also a lot of different other maintenance tasks are possible this way.

1 Like

Yes, that makes sense… thanks Norbert