Probar si un cron es ejecutado solo por el servidor [duplicado]

Posible duplicado:
En php, ¿cómo detectar la ejecución es desde el modo CLI o mediante el navegador?

How to test if a cron is executed only by the server

Muchas Gracias

preguntado el 24 de agosto de 12 a las 03:08

As opposed to being executed by what else? -

by accessing the file with the url : -

Is cron supposed to execute it directly from the shell, or by requesting it via http, like via wget? -

i set up the cron with crontab -e, but the file can be accessed via the website -

Why not set up that (presumably private) script on a different virtual host that's not listening on any external interface? -

1 Respuestas

Cron will never put anything on the display unless you use something like 'wall' in your cron script.

Are you redirecting your output to a log file or anything?

What you can do is to add a line at the bottom of the script you are executing in the cron; that does something like:

date +"%D %r `echo Cron completed`" >> /tmp/cron_job.log

Entonces podrías comprobar

cat /tmp/cron_job.log

and it would tell you when it finished.

Respondido 24 ago 12, 03:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.