Software > WeeWX

No funciona crontab

<< < (5/11) > >>

Oscar-EA5IEL:
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.

jmviper:
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

Oscar-EA5IEL:
Gracias por contestar jmviper. No entiendo lo que me quieres decir.

jmviper:
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.

Oscar-EA5IEL:
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:~ $

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

[*] Página Anterior

Ir a la versión completa