Jobs Cron funcionando esporadicamente

0

Eu tenho um computador que parece executar os trabalhos cron vezes. Quando monitoro o syslog, posso ver os trabalhos mencionados, mas os resultados dos comandos não são visíveis. Como faço para corrigir isso?

Versão desta caixa:

username:/etc$ uname -rvp
4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:25 UTC 2018 i686

O conteúdo do arquivo /etc/crontab (completo com minhas anotações):

username:/etc$ cat /etc/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   = minute
# h   = hour (24-hour)
# dom = day of month
# mon = month (numeric)
# dow = day of week (sunday is 0, monday is 1, saturday is 6)
# user    = user
# command = yep
# *       = blank or null entry or wildcard

# 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 )
01 18   * * 1   root    /sbin/shutdown -h now
00 20   * * 1   root    /sbin/shutdown -h now
01 18   * * 2   root    /sbin/shutdown -h now
00 20   * * 2   root    /sbin/shutdown -h now
01 18   * * 3   root    /sbin/shutdown -h now
00 20   * * 3   root    /sbin/shutdown -h now
01 18   * * 4   root    /sbin/shutdown -h now
00 20   * * 4   root    /sbin/shutdown -h now
01 18   * * 5   root    /sbin/shutdown -h now
00 20   * * 5   root    /sbin/shutdown -h now
01 16   * * 6   root    /sbin/shutdown -h now
00 20   * * 6   root    /sbin/shutdown -h now
## This is a test entry.
45 10   * * *   root    /usr/bin/notify-send 'Cronjob Test Message' 'This is a cronjob test message.'
46 10   * * 1   root    /usr/bin/notify-send 'Cronjob Monday Test Message' ' This is Mondays cronjob test message.'
20 11   * * *   root    /usr/bin/notify-send 'Test' 'Message goes here.'
#51 11   * * 4   root    shutdown -h now
# This line is the last line, be sure to terminated this line with a new line.

Por favor note que eu tenho vários testes acontecendo lá. Eu percebo que isso é confuso, por isso vou simplificar o arquivo /etc/crontab para facilitar a solução de problemas. Este é o novo arquivo de solução de problemas /etc/crontab :

username:/etc$ cat /etc/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

56 11   * * *   root    /usr/bin/notify-send 'Test' 'Message goes here.'

Agora, vejo meu syslog:

username:/etc$ /usr/bin/sudo /usr/bin/tail /var/log/syslog -f
Jan 29 10:58:31 hostname dbus[730]: [system] Successfully activated service 'org.freedesktop.timedate1'
Jan 29 10:58:31 hostname systemd[1]: Started Time & Date Service.
Jan 29 11:10:01 hostname cron[759]: (*system*) RELOAD (/etc/crontab)
Jan 29 11:10:01 hostname CRON[3240]: (root) CMD (/usr/bin/notify-send 'Test' 'Message goes here.')
Jan 29 11:17:01 hostname CRON[3283]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jan 29 11:19:01 hostname cron[759]: (*system*) RELOAD (/etc/crontab)
Jan 29 11:20:01 hostname CRON[3314]: (root) CMD (/usr/bin/notify-send 'Test' 'Message goes here.')
Jan 29 11:34:35 hostname crontab[3386]: (root) BEGIN EDIT (root)
Jan 29 11:35:46 hostname crontab[3386]: (root) END EDIT (root)
Jan 29 11:55:01 hostname cron[759]: (*system*) RELOAD (/etc/crontab)
Jan 29 11:56:01 hostname cron[759]: (*system*) RELOAD (/etc/crontab)
Jan 29 11:56:01 hostname CRON[3537]: (root) CMD (/usr/bin/notify-send 'Test' 'Message goes here.')

A última linha diz às 11:56:01 que ele executou o comando /usr/bin/notify-send , mas nenhuma mensagem pop-up foi exibida.

Se eu executar o comando exato (copiar e colar) em um terminal, precedido de /usr/bin/sudo , o pop-up aparecerá.

username:/etc$ /usr/bin/sudo /usr/bin/notify-send 'Test' 'Message goes here.'

Se eu executar o comando exato (copiar e colar) de um terminal como o usuário normal conectado, o pop-up será exibido.

username:/etc$ /usr/bin/notify-send 'Test' 'Message goes here.'

O que dá?

    
por Joshua Ravin 29.01.2018 / 19:09

0 respostas