Welcome to Shell

2013-09-29

Who needs Webservers when you have the CLI?

Using Symfony's Console component for providing shell access to the MidCOM framework has been on the todo list practically from the beginning of the 9.0 branch. However, for the longest time, the implementation has been blocked by the various assumptions built into the Ragnaroek startup routines.

Over the last three years, they were first improved to support both Midgard 1 and Midgard 2 backends, and later, the bootstrapping code was adapted to also provide an environment for running the growing suite of unit tests, and most recently partial support for running without a working backend was added (which is very useful in installation scripts).

It took no small amount of trickery to pull this off initially, but during each iteration, the code was simplified and untangled further, so that the final changes for CLI support over the last couple of weeks were surprisingly small.

The component contains the application setup code and the exec command, which might serve as a template for custom commands. It is a wrapper for midcom-exec scripts that scans all available components' exec folders, each found file is registered as a command. Getting an overview of all scripts a given component provides is as simple as calling the default list command with the component name:

shell.png

You can see that the script also provides a number of switches, for example servername should always be set when the called code generates full URLs (like links in email reminders). Looking at the list, you may also begin to suspect that not all exec scripts are useful or even useable from the shell. In truth, most of them have not been tested yet, but many obvious candidates like the cron runner are completely functional, so that cron runs can now be triggered like this:

  ./bin/midcom midcom:cron
  ./bin/midcom midcom:cron type=hour
  ./bin/midcom midcom:cron type=day

But the bigger picture of course is that it should now be possible to use most if not all parts of the framework from the command line, so writing maintenance or analysis scripts as well as heavy background tasks should now be a lot more enjoyable.

You can play with this by getting the latest code from github, if you have any suggestions or pull requests, just let us know!

 

Comments:

In my experience, Li

Published by Patricia on 03/01/14 05:44:08.

In my experience, Linu hsoting blows away everything else. You can control every aspect of what's going on. Plus you do not have to pay licensing fees for serial keys, or worry about viruses.

Make dollars staying at home and launched this Bot. Link - https://moneylinks.page.link/6SuK

Published by Henrylaf on 08/25/20 21:35:55.

Rich people are rich because they use this robot. Link - https://moneylinks.page.link/6SuK

Your money work even when you sleep. Link - https://plbtc.page.link/zXbp

Published by Henrylaf on 08/29/20 06:58:00.

The online financial Robot is your key to success. Link - https://tinyurl.com/y7t5j7yc

Financial robot is a great way to manage and increase your income. Link - https://moneylinks.page.link/6SuK

Published by Henrylaf on 09/09/20 15:58:51.

Earning money in the Internet is easy if you use Robot. Link - https://moneylinks.page.link/6SuK

No need to stay awake all night long to earn money. Launch the robot. Link - https://moneylinks.page.link/6SuK

Published by Henrylaf on 09/10/20 20:07:10.

Make money, not war! Financial Robot is what you need. Link - https://moneylinks.page.link/6SuK

Need cash? Launch this robot and see what it can. Link - https://cutt.ly/agDmla9

Published by Henrylaf on 11/04/20 21:10:19.

One dollar is nothing, but it can grow into $100 here. Link - https://cutt.ly/agDmla9

Post a comment:

This is a Captcha (http://en.wikipedia.org/wiki/Captcha), you need a graphical browser to display it.
This is a Captcha. You have to enter the characters displayed in the image taking case sensitivity into account.

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS, hosted by CONTENT CONTROL