Meteoclimatic
Software => WeeWX => Mensaje iniciado por: EA5AW en 18 de Enero del 2017, 20:49:16 pm
-
Tengo problemas con crontab, puedo ejecutarlo en manual y funciona pero no así en automático.
Creo que lo fastidié ayer, intentando hacer funcionar el backup para el usb, al editar crontab se abrió con el joe ¿editor por defecto? creo que se llama así, ahora parece que cuando se ejecuta llama /temp/crontab.T8JV... que es donde se alojó y no al /etc/crontab que es donde esta el script.
Eso es lo que pienso que ocurre que cron no funciona, mis conocimientos son muy remotos y no doy con ello.
Gracias.
-
Veamos, no me queda my claro que es lo que pasa.
cron lee /etc/crontab para hacer sus "necesidades"
De hecho, lo lee cada vez que se modifica el fichero /etc/crontab
No obstante, en los ficheros de log, si hay algún problema lo podrás ver.
De todos modos, si pones una copia del /etc/crontab podremos echar un vistazo.
73
-
A ver si llega el archivo que nunca he adjuntado nada hasta la fecha.
-
Adjunto weewx.log por si se observa algo raro.
73
-
Ultimo fichero generado var/log/meteoclimatic.log por si es el problema, hay dos datos mensuales que se envian menores que otros ya enviados diarios.Humedad Max.mensual 1030.3 y Presion Max. mensual 95
DATA2
ESPVA1200000012539B
xxxxxxxxxxxxxxxxxxxxxxxx
18-01-2017 18:50
4.1
3
315
1021.1
44
0
0
9.7
1.1
44
18
1021.1
1018.4
29
0
0
0.0
20.1
1.1
90
18
1024.9
1009.8
63
0
0
0.0
20.1
1.1
90
18
1024.9
1009.8
63
0
0
0.0
18-01-2017 18:50
GET /?
T=f;1Z;B;3F;B;3F;B&H=i;i;I;1S;I;1S;I&B=2eh;2eh;2eG;2fJ;2cs;2fJ;2cs&W=55;U;;4g;AA;AA&P=;;&S=;;;&V=;;;&U=3a;ESPVA1200000012539B;e4090b3276 HTTP/1.0
HOST: pool.meteoclimatic.com
User-Agent: Meteoclimatic_HTTP/1.0 (Davis Vantage Vue)
-- 18/01/2017 18:50:38 --
HTTP/1.1 202 Accepted
Date: Wed, 18 Jan 2017 18:50:33 GMT
Server: Apache/2.4.10 (Debian)
X-Error: 202 Accepted
X-DigestKey:
Content-Length: 69
Content-Type: text/plain;charset=UTF-8
Ver: 3a - ID: ESPVA1200000012539B
Query Length: 136
202: Accepted
-
Juanvi, no me queda claro que es lo que te va en manual y no en automático.
Que es el backup o el envío a meteoclimatic?
Sobre lo de los errores de la ya enviado, es que a veces se genera este tipo de errores, no tengo claro ahora mismo el por qué, se les llama inconsistencias y se corrigen desde la opción Mis Datos en la web de meteoclimatic identificándose como estación registrada. Se pone lo que envía realmente y cuando los datos concuerdan, adiós a la inconsistencia.
Salu2
Xavi, EA5ZF
-
Hola Xavi. Hace dos días que no envía a meteoclimatic, no así cuando yo ejecuto el php en manual que si envía, desde entonces tampoco se hacen los backups diarios.
-
Y ¿por qué esta línea?
1-59/5 * * * * root /root/meteoclimatic/meteoclimatic.sh>/dev/null 2>&1
No digo que sea incorrecta, el tema de los desvíos de entrada y salida de Linux no lo domino.
El tema de la inconsistencia lo tienes generado en Weewx....si revisas los resúmenes mensuales podrás ver donde está el error y corregirlo, con cuidado, en la base de datos.
-
¿cron no debe de estar siempre en marcha? termino de probar esto:
/etc/init.d/cron status
[FAIL] cron in not running ... failed!
73
-
Hola Jantoni, pues es cosa de Xavi así lo dejó el, estaba funcionando con esa salida desde el principio.
Gracias.
-
Cron siempre debe estar funcionando
Prueba a iniciarlo manualmente a ver que te dice
Ah, la causa más común de que cron no funcione suele ser la de permisos erroneos en /etc/crontab, pero no es exclusivo
-
1-59/5 * * * * root /root/meteoclimatic/meteoclimatic.sh>/dev/null 2>&1
Lo tuve que poner así, porque en modo manual en mi mele funcionaba, y con el cron no, el problema que me reportaba es que no había donde sacar las salidas de la ejecución del sh, con lo que con ese añadido, las salidas se ignoraban y el sh se ejecutaba.
> is for redirect
/dev/null is a black hole where any data sent, will be discarded
2 is the file descriptor for Standard Error
> is for redirect
& is the symbol for file descriptor (without it, the following 1 would be considered a filename)
1 is the file descriptor for Standard Out
Therefore >/dev/null 2>&1 is redirect the output of your program to /dev/null. Include both the Standard Error and Standard Out.
Del resto ya no sé que es lo que motiva que el cron no aparezca en marcha, si un error puntual u otro motivo, yo lanzaría a mano el servicio y vería que es lo que lo tumba en alguno de los logs de /var/log
/etc/init.d/cron start
-
Al intentar arrancar el cron me dice que no existe el directorio, /var/spool/cron los he creado y poner lo en marcha /etc/init.d/cron start
El cron se ha puesto en marcha y ha lanzado en automático la subida ha meteoclimatic, pero solo la ha hecho una vez.
Si lo compruebo el cron está rodando.
-
Si te sigue dando problemas, puedes probar a reinstalar cron
Antes, acuerdate de sacar una copia de /etc/crontab
sudo apt-get install --reinstall cron
-
Voy ha hacer copia y lo reinstalare, parece que todo está correcto y sigue sin ejecutarse el crontab en automático.
Gracias 73 --... ...--
-
Intento reinstalar cron sudo apt-get install --reinstall cron
E: no se pudo abrir el fichero de bloqueo <</var/lib/dpkg/lock>> - open (2: no existe el fichero o el directorio)
E: no se encontro un archivo de replica <</var/lib/dpkg/>>
-
Ummmmm......ese tipo de error es mala cosa.
Pero antes de tirarnos de los pelos, vamos a intentarlo como root y no con sudo
Identifícate como root y haz lo mismo que te dije.
Si la cosa sigue igual, la cosa no pinta bien
-
Jantoni, eso del apt ya lo tiene corregido, me conecté en remoto a su servidor y le arreglé los problemas del cron y del backup.
Y me dí cuenta de que había movido algunos directorios de /var a otro sitio, al reponerlos se puso ya todo en orden.
Aprender tiene sus cosas...
-
Muchas gracias a los dos, na hay nada mejor que tener un buen soporte técnico y humano.
Para mí ponerme en estos fregaos me supera y no poco, sin gente como vosotros esto sería impensable.
apla3
-
Es una causa de ese error.....el mover directorio de /var a otros sitios....
Pero me extrañaba que lo hubiera hecho ;D ;D ;D ;D ;D
-
Continuo este hilo que el compañero Juanvi inicio. Despues de tener operativo el weewx y funcionando me surge el mismo problema que tenia el.
No consigo que crontab me funcione en meteoclimatic. En este tema no tengo ni idea de por donde empezar. Lo tengo como indica el compañero Jantoni en el manual. He hecho una copia del fichero y lo he vuelto a reinstalar, pero sigue sin funcionar. A ver quien me puede ayudar.
Gracias de antemano.
pi@raspberrypi:/etc $ cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
root@raspberrypi:/etc# cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
# Copia de seguridad de Weewx en disco de red a las 23:55 de cada dia
55 23 * * * root /etc/weewx/backup
# Envía datos a Meteoclimatic cada 5 minutos, empezando en el minuto 1 de cada hora
1-59/5 * * * * root /root/meteoclimatic/meteoclimatic.sh
pi@raspberrypi:/etc $
pi@raspberrypi:/etc $ /etc/init.d/cron status
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-11-26 20:33:01 CET; 20h ago
Docs: man:cron(8)
Main PID: 6504 (cron)
Tasks: 1 (limit: 2200)
Memory: 4.6M
CGroup: /system.slice/cron.service
└─6504 /usr/sbin/cron -f
nov 27 16:32:02 raspberrypi CRON[11631]: pam_unix(cron:session): session closed for user root
nov 27 16:39:01 raspberrypi CRON[11649]: pam_unix(cron:session): session opened for user root by (uid=0)
nov 27 16:39:01 raspberrypi CRON[11654]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
nov 27 16:39:01 raspberrypi CRON[11649]: pam_unix(cron:session): session closed for user root
nov 27 16:47:01 raspberrypi CRON[11717]: pam_unix(cron:session): session opened for user root by (uid=0)
nov 27 16:47:01 raspberrypi CRON[11721]: (root) CMD (root /root/meteoclimatic/meteoclimatic.sh)
nov 27 16:47:01 raspberrypi CRON[11717]: pam_unix(cron:session): session closed for user root
nov 27 17:02:01 raspberrypi CRON[11741]: pam_unix(cron:session): session opened for user root by (uid=0)
nov 27 17:02:01 raspberrypi CRON[11745]: (root) CMD (root /root/meteoclimatic/meteoclimatic.sh)
nov 27 17:02:01 raspberrypi CRON[11741]: pam_unix(cron:session): session closed for user root
Hint: Some lines were ellipsized, use -l to show in full.
-
Jantoni lo puso en la carpeta de root así que la línea para que suba la plantilla la tienes que poner en el crontab de root:
sudo crontab -e
Para ver su contenido:
sudo crontab -l
-
Gracias por contestar jmviper. No entiendo lo que me quieres decir.
-
Simplemente que los archivos necesarios para subir la plantilla (meteoclimatic.sh, meteoclimatic.ini etc etc) los tienes en /root y esa carpeta sólo es accesible por root así que para tener permiso tendrás que editar el crontab de root para poner la línea para la subida. Por lo tanto tendrás que ponerla con sudo crontab -e.
Si estando como usuario pi accedes a crontab -e accedes al crontab de pi y si pones sudo crontab -e al de root el cual no tiene restricciones.
-
Disculpa si no te he entendido, pero creo que ya lo tengo así.
pi@raspberrypi:~ $ sudo crontab -l
# 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
2 0 * * * /home/pi/copiaweewx.sh
root@raspberrypi:/etc# cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
# 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 /root/meteoclimatic/meteoclimatic.sh
pi@raspberrypi:~ $
-
Ok lo estás poniendo en el crontab general y no en el de usuarios.
Tiene permisos de ejecución /root/meteoclimatic/meteoclimatic.sh ??
-
Ahondando un poco más en el tema de configurar la utilidad para el envío a meteoclimatic hay un par de cuestiones:
Primera.- No hace falta poner los archivos de la utilidad de meteoclimatic (meteoclimatic.sh, meteoclimatic.ini y meteoclimatic_http.php) en la carpeta de /root. Se pueden poner perfectamente en la carpeta de /home/pi creando una nueva al caso como /home/pi/meteoclimatic
Dándole permisos de ejecución a meteoclimatic.sh basta (chmod +x meteoclimatic.sh) sin el sudo delante siempre que sean propiedad de pi.
Entonces para que suba automáticamente sólo hace falta que esté en el crontab de pi (crontab -e estando como ususario pi).
Segunda.-
Crontabs hay varios:
/etc/crontab es el crontab del sistema aunque se pueden poner tareas para usuarios del equipo pero es mejor no tocarlo ya que una mala sintaxis y puede no funcionar el crontab.
Si se quiere hacer así es mejor crear un crontab específico en /etc/cron.d (el directorio de cron) ya que podemos ponerlo específicamente sin riesgo de poner en compromiso el crontab del sistema.
sudo nano /etc/cron.d/meteoclimatic
En su interior ponemos:
#Cron para meteoclimatic
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15,30,45,59 * * * * root /root/meteoclimatic/meteoclimatic.sh
Todo esto en caso de que tengamos la utilidad en /root/meteoclimatic
También se puede poner en el crontab de root (sudo crontab -e) esa línea del envío y, como he dicho antes, ponerse todo en una carpeta de pi y no hace falta tocar nada del root del sistema.
Todo esto no quiero hacerlo con la intención de enredarlo todo sino de intentar hacer ver que hay "diferentes formas" y que con todas se puede hacer funcionar.
-
Ok lo estás poniendo en el crontab general y no en el de usuarios.
Tiene permisos de ejecución /root/meteoclimatic/meteoclimatic.sh ??
root@raspberrypi:~# ls -l
total 4
drwxr-xr-x 2 root root 4096 nov 26 19:40 meteoclimatic
-
He hecho lo que me comentas de ponerlos en el directorio /home/pi creando la carpeta meteoclimatic y poniendo ahí los ficheros.
pi@raspberrypi:~ $ chmod +x meteoclimatic.sh
chmod: no se puede acceder a 'meteoclimatic.sh': No existe el fichero o el directorio
pi@raspberrypi:~ $ sudo chmod +x /home/pi/meteoclimatic/meteoclimatic.sh
pi@raspberrypi:~ $
pi@raspberrypi:~ $ php /home/pi/meteoclimatic/meteoclimatic_http.php
?
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
Ahondando un poco más en el tema de configurar la utilidad para el envío a meteoclimatic hay un par de cuestiones:
Primera.- No hace falta poner los archivos de la utilidad de meteoclimatic (meteoclimatic.sh, meteoclimatic.ini y meteoclimatic_http.php) en la carpeta de /root. Se pueden poner perfectamente en la carpeta de /home/pi creando una nueva al caso como /home/pi/meteoclimatic
Dándole permisos de ejecución a meteoclimatic.sh basta (chmod +x meteoclimatic.sh) sin el sudo delante siempre que sean propiedad de pi.
Entonces para que suba automáticamente sólo hace falta que esté en el crontab de pi (crontab -e estando como ususario pi).
Segunda.-
Crontabs hay varios:
/etc/crontab es el crontab del sistema aunque se pueden poner tareas para usuarios del equipo pero es mejor no tocarlo ya que una mala sintaxis y puede no funcionar el crontab.
Si se quiere hacer así es mejor crear un crontab específico en /etc/cron.d (el directorio de cron) ya que podemos ponerlo específicamente sin riesgo de poner en compromiso el crontab del sistema.
sudo nano /etc/cron.d/meteoclimatic
En su interior ponemos:
#Cron para meteoclimatic
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15,30,45,59 * * * * root /root/meteoclimatic/meteoclimatic.sh
Todo esto en caso de que tengamos la utilidad en /root/meteoclimatic
También se puede poner en el crontab de root (sudo crontab -e) esa línea del envío y, como he dicho antes, ponerse todo en una carpeta de pi y no hace falta tocar nada del root del sistema.
Todo esto no quiero hacerlo con la intención de enredarlo todo sino de intentar hacer ver que hay "diferentes formas" y que con todas se puede hacer funcionar.
-
Veamos
Ponme el resultado de ejecutar los siguiente:
ls -l /home/pi/meteoclimatic
cat /home/pi/meteoclimatic/meteoclimatic.sh
cat /home/pi/meteoclimatic/meteoclimatic.ini
Quita contraseña de meteoclimatic.ini cuando lo pegues aquí
-
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
-
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
-
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.
-
Ok perfecto
esperemos que esta haya sido la buena.
Saludos
-
jajajajaja... eso espero. Estoy atento al siguiente envio.
-
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
-
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
-
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.....
-
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
-
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
-
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 ?
-
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
-
Lo he cambiado a /home/pi/meteoclimatic/meteoclimatic.log
Ok ahí también lo irá escribiendo
-
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 $
-
Es una advertencia, debería de funcionar el script.
el campo *WRUN no lo procesa ni muestra meteoclimatic
-
Hace el envío cada vez que ejecuto:
php /home/pi/meteoclimatic/meteoclimatic_http.php
pero luego ya no vuelve a hacer el envío más.
-
Modificaste la línea de crontab quitando root de la línea ?
-
Lo tengo así:
pi@raspberrypi:~ $ crontab -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
-
Deja la línea que envía a meteoclimatic así:
2-59/15 * * * * /home/pi/meteoclimatic/meteoclimatic.sh
-
Hecho:
# 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 * * * * /home/pi/meteoclimatic/meteoclimatic.sh
-
Quizás también den problemas estas dos líneas en ese crontab:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
puedes quitarlas
-
Listo:
# 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
# Envía datos a Meteoclimatic cada 15 minutos, empezando en el minuto 2 de cada hora
2-59/15 * * * * /home/pi/meteoclimatic/meteoclimatic.sh
-
jmviper, esta vez si. Podemos decir que ya está solucionado. Desde ayer noche hasta el momento del mensaje está subiendo datos.
Gracias de nuevo por tu ayuda.
Saludos.
-
Perfecto
Saludos