Software > WeeWX
No funciona crontab
jmviper:
Por cierto ahora que veo tu anterior mensaje.
--- Cita de: Oscar-EA5IEL en 28 de Noviembre de 2019, 19:26:13 ---
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
--- Fin de la cita ---
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
Oscar-EA5IEL:
pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
/home/pi/meteoclimatic/meteoclimatic.sh: línea 7: /var/log/meteoclimatic.log: Permiso denegado
--- Cita de: jmviper en 28 de Noviembre de 2019, 20:09:53 ---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
--- Fin de la cita ---
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
Oscar-EA5IEL:
--- Cita de: Oscar-EA5IEL en 28 de Noviembre de 2019, 20:30:38 ---pi@raspberrypi:~ $ /home/pi/meteoclimatic/meteoclimatic.sh
/home/pi/meteoclimatic/meteoclimatic.sh: línea 7: /var/log/meteoclimatic.log: Permiso denegado
--- Cita de: jmviper en 28 de Noviembre de 2019, 20:09:53 ---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
--- Fin de la cita ---
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
--- Fin de la cita ---
Sigue igual, no sube los datos.....
Oscar-EA5IEL:
--- Cita de: jmviper en 28 de Noviembre de 2019, 20:09:53 ---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
--- Fin de la cita ---
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
jmviper:
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
Navegación
[#] Página Siguiente
[*] Página Anterior
Ir a la versión completa