Where is the Magento 2 update/cron.php file supposed to come from? - magento2

I have installed Magento 2 using the instructions in the development documentation.
Everything works fine except for the cron jobs that the admin system continually says are not working.
I followed the development docs and added the following lines into my crontabs file.
*/1 * * * * php -c /etc/php5/cli/apache2 /var/www/html/magento2/bin/magento cron:run
*/1 * * * * php -c /etc/php5/cli/apache2 /var/www/html/magento2/update/cron.php
*/1 * * * * php -c /etc/php5/cli/apache2 /var/www/html/magento2/bin/magento setup:cron:run
I have manually run the first and third command and they run without error. The second line I am having problems with. /var/www/html/magento2/update/cron.php does not exist. In fact the update directory does not exist.
Where does the update directory come from, and why don't I have it?

update/cron.php file is in the magento2-community-edition package:
https://github.com/magento/magento2-community-edition/blob/2.0.0/update/cron.php

Related

How can i add a cron job run every minute to my elearning site on moodle?

I try to add a cron job on an elearning.mysite.gr(Moodle). Although my host gives this message every hour.
Oct 2 1:10:01 linux CROND[123456]: (admin) CMD (touch /tmp/test.txt > /dev/null)
On my site administration -> notifications get this message:
The admin/cli/cron.php script has not been run for 3 days 2 hours and should run every 1 min.
At moodle documentation
/path/to/moodle/admin/cli/cron.php, can i use it ? in which way ?
I tried this :
/usr/bin/php /path/to/moodle/admin/cli/cron.php
but gives me that the process completed with error at one minute
only this touch /tmp/test.txt > /dev/null
completed with success.
Moodle Documentation:
The CLI (command line interpreter) script. This will be at the path /path/to/moodle/admin/cli/cron.php
If in doubt, this is the correct script to use. This needs to be run by a 'PHP CLI' program on your computer. So the final command may look something like /usr/bin/php /path/to/moodle/admin/cli/cron.php You can (and should) try this on your command line to see if it works. WARNING: Check your command-line PHP version is compatible with your chosen version of Moodle.-How to check it?
The command-line PHP program is different to the one running your web site and is not always the same version.
I don't know what to do...I will appreciate any help!!!
I tried by my host panel interface :
Type of progress:
Command line
URL
PHP
i should choose one from 3.
Command*:
placeholder to add my command to be excecuted
Excecute:
Dropdown
1.Cron style
2.Daily at 00:00
I use command line.
touch /tmp/test.txt
When i add
cron style and 1 * * * * * , get message for syntax.
and for
daily at 00:00 success message but on my notification of my site has
The admin/cli/cron.php script has not been run for 17 days 22 hours and should run every 1 min.
That's the icon of my Plesk Login. To change the path/to/moodle/admin/cli/cron.php xould i check the file manager in order to find cron.php file ??
As you add the cron from a web interface (maybe Plesk ?) you only need this part:
/path/to/moodle/admin/cli/cron.php
replace /path/to/moodle/ with the real path on your server, usulay something like /var/www/moodle/ or /var/www/vhosts/domain.name/httpdocs/moodle
To run every 1 minute cron style is :
* * * * *
If you can choose PHP version, choose the same version as the one you are using for Moodle.
Finally, I give this touch /tmp/test.txt ->and at cron style the touch /tmp/test.txt, as you suggest to me.
Because the other commands cannot complete with success.
But in my notifications,(Site administration-Moodle) i still get the message that cron don't run.

WP-CLI: STDOUT error when called in CRON (crontab)

Little help or guidance. Server is CentOS 7 - with WHM/CPanel installed.
Command:
$(which php) $(which wp) core update --require=/opt/wp-cli-pre.php --path=/home/USER/public_html/
The contents of /opt/wp-cli-pre.php
<?php
if(!defined('STDIN')) define('STDIN', fopen('php://stdin', 'r'));
if(!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'w'));
if(!defined('STDERR')) define('STDERR', fopen('php://stderr', 'w'));
Works as expected from the command line, but if from cron job, I get:
PHP Warning: Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php on line 1057
output of "which php"
/usr/local/bin/php
output of "which wp"
/usr/local/bin/wp
I have installed the latest WP-CLI from https://wp-cli.org/
At long last, I have found the solution.
When the CRON runs a PHP script like this: */5 * * * * php /path/to/script.php
The SAPI name is: cgi-fcgi (on a WHM/CPanel install on CentOS)
It cannot find the CLI version setup by CPanel at /usr/local/bin/php as the $PATH var is just: /usr/bin:/bin
So, the solution is to not depend on the system environment to determine the PHP you want. But to set that directly.
Like this: */5 * * * * /usr/local/bin/php /path/to/script.php
It was always my assumption that if a CRON was setup in ROOT's crontab, it would inherit ROOT's environment. This apparently is not the case.
You should take a look at the following post.
https://forums.cpanel.net/threads/users-cannot-use-wp-cli-in-cron.643293/

When cron file will execute if crontab has schdule earlier then server cron

To set the magento cron we need to add following commands in crontab file on server.
*/10 * * * <path to php binary> <magento install dir>/bin/magento cron:run
*/10* * * * <path to php binary> <magento install dir>/update/cron.php
*/10 * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run
and we can create the custom cron with crontab.xml
<group id="default">
<job name="custom_cronjob" instance="Magento\SampleMinimal\Cron\Test" method="execute">
<schedule>*/5 * * *</schedule>
</job>
</group>
As you can see default magento cron is set for every 10 minutes and magento custom cron is set every 5 minutes.
So my question is custom cron will execute in every 15 minutes or will it execute in every 5 minutes?
You must to install magento crontab by command:
php bin/magento cron:install
In magento 2, cron runs every minute. After install, you will see:
* * * * * /usr/bin/php7.0 /var/www/html/your_project/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/your_project/var/log/magento.cron.log
* * * * * /usr/bin/php7.0 /var/www/html/your_project/update/cron.php >> /var/www/html/your_project/var/log/update.cron.log
* * * * * /usr/bin/php7.0 /var/www/html/your_project/bin/magento setup:cron:run >> /var/www/html/your_project/var/log/setup.cron.log

Jupyter pdf export cuts off after one page

I'm trying to export a 3page jupyter notebook to pdf,
but the downloaded document cuts off after only 1 page.
Print-preview runs fine.
I don't have more details than this, did you ever get across a bug like this?
I have no idea how to trouble shoot this and every tip would be highly appreciated.
The bash text is (sorry for long text):
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./notebook.tex
LaTeX2e <2017-04-15>
Babel <3.10> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
....
Package inputenc Warning: inputenc package ignored with utf8 based engines.
Package hyperref Message: Driver (autodetected): hxetex.
No file notebook.aux.
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
*geometry* verbose mode - [ preamble ] result:
* driver: xetex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=59.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \#twocolumnfalse
* \#twosidefalse
* \#mparswitchfalse
* \#reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
Package hyperref Warning: Rerun to get /PageLabels entry.
LaTeX Warning: No \author given.
(/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/se-ascii-print.def)
(/usr/local/texlive/2017/texmf-dist/tex/latex/lm/t1lmtt.fd)
(/usr/local/texlive/2017/texmf-dist/tex/latex/psnfss/ts1ppl.fd) [1]
! Missing $ inserted.
<inserted text>
$
l.341 function for three types of agents, \$\alpha
- \$, \(\beta-\) type of
?
! Emergency stop.
<inserted text>
$
l.341 function for three types of agents, \$\alpha
- \$, \(\beta-\) type of
Output written on notebook.pdf (1 page).
Transcript written on notebook.log.
You are probably having an error in the compile. See Issue 893. I had a similar problem today, running on a Windows machine. I only got a single pdf page out of a five page document.
I selected "download as LaTex/Tex" (in open Jupyter notebook session) then opened that tex file in my TeX editor (TeXworks). It may be zipped if you have images, just extract the file(s) if so.
I then compiled with Xelatex, which tripped on the error and showed it (in the compile log) to be simply a blank space I left between an inline LaTex "$" delimiter and the beginning of some LaTex. I removed the blank space so I had "$\mathrm{MeV}" instead of "$ \mathrm{MeV}" and it compiled fine.
I subsequently tested a direct "download as PDF from LaTex" in my Jupyter notebook on the corrected ipnyb file and it performed perfectly.

Trigger email send after cron job finished

I have a cron file that contain this
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
MAILTO="myemail#gmail.com"
* * * * * php /home/forge/biossantibodies/artisan products:exportdiff --env=development
* * * * * php /home/forge/biossantibodies/artisan images:exportdiff --env=development
* * * * * php /home/forge/biossantibodies/artisan publications:exportdiff --env=development
* * * * * mailx -s "CronJob is run successfully" ben#gmail.com
I want it to send email to me after the cron job successfully ran.
I've tried:
MAILTO="myemail#gmail.com"
and:
* * * * * mailx -s "CronJob is run successfully" myemail#gmail.com
And I never received any emails, I looked in the spam folder as well, but I noticed the task between them work.
How would one go about configuring this?