Is there a "magic" name for a recipe that will cau...
# box-products
j
Is there a "magic" name for a recipe that will cause it to be executed when commandbox starts? I want a specific server to be fired up on box startup, and some stats output.
b
@JTDavis not really
If you know box will always be starting in a specific folder, you could add an
onCLIStart
package script to the
box.json
in that folder which ran the recipe
That's sort of ad oddly specific scenario however. Most people who want a server to auto-start just set it up as a service so it starts on boot
And we do have a commercial module to help with that https://commandbox-service-manager.ortusbooks.com/
j
Good info, Thanks, Brad.
b
You could also write a custom module you install into CommandBox which listens to the onCliStart interceptor which would be roughly the equiv of the package script above, but wouldn't matter what dir the shell is started in.
This is a lot of work to not have to just type
Copy code
start
however 😉
you can even do it all with your left hand!
s
and you can alias the command to just
s
!
😆 1
for that matter, if you really wanted a quick way to start 2 servers at the same time im sure you could create an alias so that you can do this
Copy code
commandbox> start && startother
b
True, but that would wreak havok when running actual commands that started with the letter
s
unless you included a space in your alias.
Hmm, I wonder if I should actually just change CommandBox to match the first full token 🤔