These are some examples of advanced behaviors that can be configured in MiGA
Controlling many daemons at once
The MiGA CLI includes support for mass-controlled daemons when several MiGA projects are in the same folder using the miga lair command.
The MiGA Lair will find all the MiGA projects in a folder (or subfolders) and control all the corresponding daemons together:
# Check the current status of all the daemonsmigalairlist-p/path/to/folder# Terminate all the daemons at oncemigalairterminate-p/path/to/folder# Launch and daemonize a process to keep all daemons runningmigalairstart-p/path/to/folder# See more optionsmigalair-h
Sending an email when the project is ready
If your project runs for a long time and you want to be notified by email when it's ready, you can use project hooks:
In the MiGA Console:
Make sure to change /path/to/project to the project path and [email protected] to the email where you want to receive the notification. Also, note that depending on your sendmail configuration you might get that email in the spam folder (or flat-out rejected), so make sure to test sendmail first.
# First cd to the project folder
cd /path/to/project
# And open the MiGA Console
miga c
# Set the hook "on_preprocessing_ready" to
# execute a shell command ("run_cmd") consisting of
# sending an email with the project path ("{{project}}")
MiGA::Project.load('.').tap do |p|
p.metadata[:on_preprocessing_ready] = [
['run_cmd', 'echo \'Project ready: {{project}}\' | sendmail [email protected]']
]
end.save
quit