Console scripts
Part of the behaviour of Goteo must be achieved by the use of console commands. These commands processes end-round termination project status changes, refunding payments for failed processes, etc.
All commands uses the Symfony Console component
Should be run in a terminal with the cli version of PHP:
php bin/console
Or, if bin/console is executable (which is by default), simply type (in the Goteo project folder):
bin/console
Or, if using Docker, just add docker/exec in front of the commands.
Last commands should show you a list of available commands.
Any command has his help message:
bin/console test --help
Mandatory Cron commands:
Goteo system needs to execute some periodic tasks in order to keep the projects funding status up to date. Other task involve sending mails to owners and investors (backers) and database cleaning.
Although there are many required commands that need to be executed periodically, a convenient cron script is available in order to keep the installation clean.
Just add to your /etc/cron.d/goteo (or similar) system:
* * * * * www-data nice /usr/bin/php /path/to/installation/bin/console cron --lock --logmail > /dev/null 2>&1
Where www-data is the web server user. Alternatively you can use a crontab format in case you prefer the crontab command:
* * * * * nice /usr/bin/php /path/to/installation/bin/console cron --lock --logmail > /dev/null 2>&1
Goteo Commands:
-
bin/console endroundThis is the most important command of all. Should be run by cron process once a day in order to check and change projects status, process refunds (if needed) among other stuff (like sending mails to owner or backers). This command triggersbin/console refundcommand to process refunds for failed projects. Running this command without the--updateoptions will not make any changes. Runbin/console endround --helpfor options and description -
bin/console refundThis command allows to process refund invests manually or automatically. Running this command without the--updateoptions will not make any changes. Runbin/console refund --helpfor options and description -
bin/console cronThis programs just runs other commands based on a schedule.
Schedule table is inResources/crontab.ymlThis command should be placed in a cron management system with the--lockoption activated: Cron line suggested example* * * * * www-data nice /usr/bin/php /path/to/installation/bin/console cron --lock --logmail > /dev/null 2>&1 -
bin/console mailingThis program processes pending massive mailing. This makes use of the concurrent capabilities Symfony process commponent so be aware that you'll need proc_open() function active in your PHP installation. -
bin/console sendmailThis program sends and individual mail from the massive mailing list. Althoug it can be used manually for testing, it's basically used by themailingtask to make concurrent sending. -
bin/console projectwatchThis command sends tips to the project's owners depending on the status of of the project (advises base on template mails). Note that this command is old and needs to be refactored (You cannot execute this command in read-only mode) bin/console dbverifyAnother old command that needs refactoring. Cleans some old databases entries.
Note that this command is old and needs to be refactored (You cannot execute this command in read-only mode)
Global options
Some options are common for all commands:
-
--helpdisplays help about the command. Example:bin/console endround --help -
--verboseDisplays on the standard console output (likeechocommand) the generated log Example:bin/console endround --verbose -
--logmailEmails the full log if a ERROR level is triggered. Email should be defined intosettings.yml->mail.failExample:bin/console endround --logmail --lockLocks the process by using theGET_LOCKfunction on MySQL server. This way the running process can be used in a replicated distributed cron system ensuring that only one instance of the process will be running. Note: Command called without this option may be allowed to execute even if some lock exists Example:bin/console endround --lock --logmail