Autor Tema: No funciona crontab  (Leído 22384 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #30 en: 28 de Noviembre del 2019, 19:59:23 pm »
Aqui lo tienes jmviper.

pi@raspberrypi:~ $ ls -l /home/pi/meteoclimatic
total 48
-rw-r--r-- 1 pi pi 19604 dic  4  2017 meteoclimatic_http.php
-rw-r--r-- 1 pi pi 19049 dic  4  2017 meteoclimatic_http.php.old
-rw-r--r-- 1 pi pi   181 nov 28 19:57 meteoclimatic.ini
-rwxr-xr-x 1 pi pi   174 nov 28 16:55 meteoclimatic.sh
pi@raspberrypi:~ $ cat /home/pi/meteoclimatic/meteoclimatic.sh

#!/bin/bash
cd /home/pi/meteoclimatic
#Si no quieres log
#php meteoclimatic_http.php.old
#Si quieres log
php meteoclimatic_http.php.old >> /var/log/meteoclimatic.log
exit


pi@raspberrypi:~ $ cat /home/pi/meteoclimatic/meteoclimatic.ini
[Global]
Stations=ESPVA0300000003009E
DigestKey=

[ESPVA0300000003009E]
Path=/var/www/html/weewx/meteoclimatic.htm
Password=-------------
StationVendor=Davis
StationModel=Vantage Pro2

Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #31 en: 28 de Noviembre del 2019, 20:09:53 pm »
No sé si será un problema escribir el log en /var/log/meteoclimatic.log. Yo lo dirigiría también a /home/pi/meteoclimatic

Qué sucede al ejecutarlo ?

/home/pi/meteoclimatic.sh


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #32 en: 28 de Noviembre del 2019, 20:11:59 pm »
jmviper, ya sube los datos a meteoclimatic.

No sé que ha pasado pero ya funciona. Muchas gracias por tu ayuda, solo no lo habría logrado.

Un saludo.


Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #33 en: 28 de Noviembre del 2019, 20:14:03 pm »
Ok perfecto

esperemos que esta haya sido la buena.

Saludos


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #34 en: 28 de Noviembre del 2019, 20:16:11 pm »
jajajajaja... eso espero. Estoy atento al siguiente envio.

Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #35 en: 28 de Noviembre del 2019, 20:20:32 pm »
Por cierto ahora que veo tu anterior mensaje.


pi@raspberrypi:~ $ crontab -e
  GNU nano 3.2                                                        /tmp/crontab.KAsowk/crontab

# 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
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#
# Copia de seguridad de Weewx en disco de red a las 23:57 de cada dia
57 23   * * *   root    /etc/weewx/backup

# Envía datos a Meteoclimatic cada 15 minutos, empezando en el minuto 2 de cada hora
2-59/15 *   * * *   root    /home/pi/meteoclimatic/meteoclimatic.sh



en el crontab de pi no hace falta poner en las tareas el usuario, en este caso root, sólo en /etc/crontab y los de /etc/cron.d

Lo de la copia de seguridad de weewx que tienes puesto puede que no funcione estando en el crontab de pi como estoy diciendo al necesitar permisos de root por lo que yo lo pondría en /etc/crontab


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #36 en: 28 de Noviembre del 2019, 20:30:38 pm »
pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
/home/pi/meteoclimatic/meteoclimatic.sh: línea 7: /var/log/meteoclimatic.log: Permiso denegado


No sé si será un problema escribir el log en /var/log/meteoclimatic.log. Yo lo dirigiría también a /home/pi/meteoclimatic

Qué sucede al ejecutarlo ?

/home/pi/meteoclimatic.sh

No comprendo lo que me quieres decir en el anterior mensaje

He quitado la copia de weewx en contab -e

# 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
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#

# Envía datos a Meteoclimatic cada 15 minutos, empezando en el minuto 2 de cada hora
2-59/15 *   * * *   root    /home/pi/meteoclimatic/meteoclimatic.sh

Y he cambiado la escritura del log.

pi@raspberrypi:~ $ cat /home/pi/meteoclimatic/meteoclimatic.sh

#!/bin/bash
cd /home/pi/meteoclimatic
#Si no quieres log
#php meteoclimatic_http.php.old
#Si quieres log
php meteoclimatic_http.php.old >> /home/pi/meteoclimatic/meteoclimatic.log
exit
« Última modificación: 28 de Noviembre del 2019, 20:36:59 pm por Oscar-EA5IEL »

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #37 en: 28 de Noviembre del 2019, 20:38:17 pm »
pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
/home/pi/meteoclimatic/meteoclimatic.sh: línea 7: /var/log/meteoclimatic.log: Permiso denegado


No sé si será un problema escribir el log en /var/log/meteoclimatic.log. Yo lo dirigiría también a /home/pi/meteoclimatic

Qué sucede al ejecutarlo ?

/home/pi/meteoclimatic.sh

No comprendo lo que me quieres decir en el anterior mensaje

He quitado la copia de weewx en contab -e

# 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
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#

# Envía datos a Meteoclimatic cada 15 minutos, empezando en el minuto 2 de cada hora
2-59/15 *   * * *   root    /home/pi/meteoclimatic/meteoclimatic.sh

Y he cambiado la escritura del log.

pi@raspberrypi:~ $ cat /home/pi/meteoclimatic/meteoclimatic.sh

#!/bin/bash
cd /home/pi/meteoclimatic
#Si no quieres log
#php meteoclimatic_http.php.old
#Si quieres log
php meteoclimatic_http.php.old >> /home/pi/meteoclimatic/meteoclimatic.log
exit


Sigue igual, no sube los datos.....

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #38 en: 28 de Noviembre del 2019, 20:45:08 pm »
No sé si será un problema escribir el log en /var/log/meteoclimatic.log. Yo lo dirigiría también a /home/pi/meteoclimatic

Qué sucede al ejecutarlo ?

/home/pi/meteoclimatic.sh

Ahora me indica esto:

pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
PHP Warning:  A non-numeric value encountered in /home/pi/meteoclimatic/meteoclimatic_http.php.old on line 71

Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #39 en: 28 de Noviembre del 2019, 20:47:31 pm »
En /var/log el usuario pi no tiene permisos para escribir en el log que se crea.

Ejecuta esto:

sudo touch /var/log/meteoclimatic.log && sudo chown pi:pi /var/log/meteoclimatic.log

Y ya irá escribiendo en ese log


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #40 en: 28 de Noviembre del 2019, 20:49:14 pm »

pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
PHP Warning:  A non-numeric value encountered in /home/pi/meteoclimatic/meteoclimatic_http.php.old on line 71


La línea 71 es la del winrun… puedes copiar y pegar la plantilla aquí (quitando sig) a ver qué pone en ese campo ?


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #41 en: 28 de Noviembre del 2019, 20:50:09 pm »
En /var/log el usuario pi no tiene permisos para escribir en el log que se crea.

Ejecuta esto:

sudo touch /var/log/meteoclimatic.log && sudo chown pi:pi /var/log/meteoclimatic.log

Y ya irá escribiendo en ese log

Lo he cambiado a /home/pi/meteoclimatic/meteoclimatic.log


Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #42 en: 28 de Noviembre del 2019, 20:51:16 pm »

Lo he cambiado a /home/pi/meteoclimatic/meteoclimatic.log


Ok ahí también lo irá escribiendo


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es

Desconectado Oscar-EA5IEL

  • Jr. Member
  • **
  • Mensajes: 72
    • Ver Perfil
  • Estación: Alacant - Nort (ESPVA0300000003009E)
Re:No funciona crontab
« Respuesta #43 en: 28 de Noviembre del 2019, 20:53:03 pm »

pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
PHP Warning:  A non-numeric value encountered in /home/pi/meteoclimatic/meteoclimatic_http.php.old on line 71


La línea 71 es la del winrun… puedes copiar y pegar la plantilla aquí (quitando sig) a ver qué pone en ese campo ?

pi@raspberrypi:/etc/weewx/skins/Seasons $ cat meteoclimatic.htm.tmpl
*VER=DATA2
*COD=ESPVA0300000003009E
*SIG=-------------------
*UPD=$current.dateTime.format("%d-%m-%Y %H:%M")
*TMP=$current.outTemp.formatted
*WND=$current.windSpeed.formatted
*AZI=$current.windDir.formatted
*BAR=$current.barometer.formatted
*HUM=$current.outHumidity.formatted
*SUN=$current.radiation.formatted
*UVI=$current.UV.formatted
*DHTM=$day.outTemp.max.formatted
*DLTM=$day.outTemp.min.formatted
*DHHM=$day.outHumidity.max.formatted
*DLHM=$day.outHumidity.min.formatted
*DHBR=$day.barometer.max.formatted
*DLBR=$day.barometer.min.formatted
*DGST=$day.windGust.max.formatted
*DSUN=$day.radiation.max.formatted
*DHUV=$day.UV.max.formatted
*DPCP=$day.rain.sum.formatted
*WRUN=
*MHTM=$month.outTemp.max.formatted
*MLTM=$month.outTemp.min.formatted
*MHHM=$month.outHumidity.max.formatted
*MLHM=$month.outHumidity.min.formatted
*MHBR=$month.barometer.max.formatted
*MLBR=$month.barometer.min.formatted
*MGST=$month.windGust.max.formatted
*MSUN=$month.radiation.max.formatted
*MHUV=$month.UV.max.formatted
*MPCP=$month.rain.sum.formatted
*YHTM=$year.outTemp.max.formatted
*YLTM=$year.outTemp.min.formatted
*YHHM=$year.outHumidity.max.formatted
*YLHM=$year.outHumidity.min.formatted
*YHBR=$year.barometer.max.formatted
*YLBR=$year.barometer.min.formatted
*YGST=$year.windGust.max.formatted
*YSUN=$year.radiation.max.formatted
*YHUV=$year.UV.max.formatted
*YPCP=$year.rain.sum.formatted
*EOT*
pi@raspberrypi:/etc/weewx/skins/Seasons $

Desconectado jmviper

  • Investigación
  • Hero Member
  • ******
  • Mensajes: 4.403
  • "Vortex Complex"
    • Ver Perfil
    • www.meteoarchena.es
  • Estación: Archena - ESMUR3000000030600B
Re:No funciona crontab
« Respuesta #44 en: 28 de Noviembre del 2019, 20:58:39 pm »
Es una advertencia, debería de funcionar el script.

el campo *WRUN no lo procesa ni muestra meteoclimatic


Archena, Valle de Ricote (Murcia). 120 msnm. 19.622 hab.
Davis Vantage Pro2 Plus

www.meteoarchena.es