Is there a way to verify that cronjobs are working properly?

I have a web application that I am trying to upgrade. Part of their upgrade process involves using a migration tool to transfer data from one version to another. This tool relies on cronjobs for it to function.

According to them, the migration is not working because my cronjobs are not working properly.

Is there a way to verify this?

Below is what I had to paste in my crontab:

MAILTO=webmaster@mymailhost.com

          • cd /srv/www/whiterhino/d7/periodic; /usr/bin/php -q cron.php

Any ideas?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

sudo tail -f /var/log/messages

Watch for any output talking about cron, so I guess you could refine that:

sudo tail -f /var/log/messages | grep -i cron

Good luck.

On 09/06/2010 06:36 PM, abacabb wrote:
>
> I have a web application that I am trying to upgrade. Part of their
> upgrade process involves using a migration tool to transfer data from
> one version to another. This tool relies on cronjobs for it to
> function.
>
> According to them, the migration is not working because my cronjobs are
> not working properly.
>
> Is there a way to verify this?
>
> Below is what I had to paste in my crontab:
>
> MAILTO=webmaster@mymailhost.com
> * * * * * cd /srv/www/whiterhino/d7/periodic; /usr/bin/php -q cron.php
>
>
> Any ideas?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMhZR0AAoJEF+XTK08PnB5mhIQAJOhUWRaZA3PqH3x0LS71prE
gJ5xDq0duzOtsrMqHSq2jZ/TdACCxkR9NzGyKlzV6aBDaUWHN9UsZqwlJdsYYN+1
ojd1so0Wjz9cdouwDeDdFtMC8GTOwoX5x6eWreSrbp0r2IqG5xlohdMtYTHfnTWc
+8pzjSapt6K8P+zuQfeaYQ7jmXfZ85MXEltC9RYBwZlLgHoKx9klLQTU3wP/tP3b
E613ZIhVfu4u5hkEfjfUYfEceVETyqEHR1bWrER1HvaRxNcJbL+fyYLrPShw07iw
Ln6sZe3z6z6oJP+vvejfYzI2UNsBVVK/VOUo9wXM7c4GDnCutlHMyaLG4XJR9Vf1
iqIQG8na/yNLEeUYzx1v4rftGUc34EcgG1wdKe62O6CotJlkqLppDe73JAKK1wIL
H6RtaazhqCetwVggsdgGVCpbNIALcC3QnSsEnCa2DgVVrKQ3osVGR9995QPttQhi
YF0zYsleuwTuU6VCIfRxU/rmt+BFMByKxhJxkwbKlKr/Xf+ADJU9gXjQIUuMFlsm
yeU4mgZqY8MkX8gx0lPVAKPoW4DkJrEo+gkoFxETc51dAY5X5wVViimS9R4A1e7x
JkThr0BmNJWwjeTMS5SET6Fv2e+KjzY77whEv0PCB3gY1JTMyTPwhxwF99KRSrrQ
/WMm36jFotyVVyUll1qa
=0UdF
-----END PGP SIGNATURE-----

You say "“my crontab” which is not very precise. Normaly this means that you area normal user (not root) and that you put this in your crontab using

crontab -e

But some people say "my crontab’ meaning e.g. root’s crontab, or /etc/crontab.

yeah I used crontab -e

Just an idea, you could add

; echo "this is cron"

(or a more usefull outcry) to your cron entry, thus forcing a mail to webmaster@mymailhost.com (I assume that normaly the running does not generate any output to standard out and thus you are wondering if it works).

Another solution is to log the output directly to a file:

          • cd /srv/www/whiterhino/d7/periodic; /usr/bin/php -q cron.php >> /var/log/mylogfile.log 2>&1

In that case you’ll see the content in the file /var/log/mylogfile.log (you need to have write permissions there).

I would change that into:

* * * * * cd /srv/www/whiterhino/d7/periodic; /usr/bin/php -q cron.php ; echo "cron.php run at $(date)" >>/tmp/mylogfile 2>&1

then. No intermingling of the “real” output with the “test” output and no need to give write access into a typical “system” place to a normal user.

But beware: this seems to be run at every minute, thus mylogfile can grow and fill your root partition when you leave the test output adding there for months lol!