AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 788942
Accepted
Dolphin
Dolphin
Asked: 2025-01-01 13:54:58 +0800 CST2025-01-01 13:54:58 +0800 CST 2025-01-01 13:54:58 +0800 CST

Por que "crontab -l" não mostra todas as tarefas?

  • 772

Adicionei o seguinte ao /etc/crontabmeu sistema Linux:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# 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
0 0 */1 * * root chmod +x /root/source/auto-renew.sh && /root/source/auto-renew.sh >> /root/source/auto-renew-cron.log 2>&1

No entanto, quando executo agora crontab -l, ele não mostra esta tarefa do crontab:

[root@iZm5e2jhfbrshckqh6qdbuZ cron.d]# crontab -l
45 6 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null

Por que não está crontab -lmostrando a /etc/crontabtarefa?

Este é o registro:

[root@iZm5e2jhfbrshckqh6qdbuZ cron.d]# journalctl -u crond
-- Logs begin at Wed 2024-11-20 15:32:06 CST, end at Wed 2025-01-01 13:54:30 CST. --
Nov 20 16:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1444408]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 17:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1486477]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 18:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1528604]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 19:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1570709]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 20:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1612872]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 21:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1655340]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 22:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1697643]: (root) CMD (run-parts /etc/cron.hourly)
Nov 20 23:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1739698]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 00:00:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1781104]: (root) CMD (chmod +x /root/source/auto-renew.sh && /root/source/auto-renew.sh >> /root/source/auto-renew-cron.log 2>&1)
Nov 21 00:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1781971]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 00:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1781980]: Anacron started on 2024-11-21
Nov 21 00:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1781980]: Normal exit (0 jobs run)
Nov 21 01:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1824103]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 01:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1824112]: Anacron started on 2024-11-21
Nov 21 01:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1824112]: Normal exit (0 jobs run)
Nov 21 02:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1866166]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 02:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1866175]: Anacron started on 2024-11-21
Nov 21 02:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1866175]: Normal exit (0 jobs run)
Nov 21 03:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1908181]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 03:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Anacron started on 2024-11-21
Nov 21 03:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Will run job `cron.daily' in 50 min.
Nov 21 03:01:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Jobs will be executed sequentially
Nov 21 03:51:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Job `cron.daily' started
Nov 21 03:51:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Job `cron.daily' terminated
Nov 21 03:51:01 iZm5e2jhfbrshckqh6qdbuZ anacron[1908190]: Normal exit (1 job run)
Nov 21 04:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1950218]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 05:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[1992303]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 06:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2034382]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 07:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2076636]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 08:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2118744]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 09:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2160824]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 10:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2203126]: (root) CMD (run-parts /etc/cron.hourly)
Nov 21 11:01:01 iZm5e2jhfbrshckqh6qdbuZ CROND[2245206]: (root) CMD (run-parts /etc/cron.hourly)
cron
  • 1 1 respostas
  • 64 Views

1 respostas

  • Voted
  1. Best Answer
    ilkkachu
    2025-01-01T16:35:50+08:002025-01-01T16:35:50+08:00

    crontab -lmostra o arquivo crontab por usuário (em algum lugar como /var/spool/cronou algo assim). Ele pode ser usado por qualquer usuário, e root não é uma exceção aqui.

    Os arquivos /etcsão crontabs de todo o sistema, não vinculados a um usuário específico, e a crontabferramenta não os edita.

    Talvez você queira usar arquivos em /etc/cron.d, ou /etc/cron.dailyetc. para melhor compartimentação.

    Há mais discussão sobre isso em, por exemplo, System Crontab ou Root Crontab

    • 7

relate perguntas

  • Como o anacron funciona se não é um daemon?

  • Tarefas do cron não funcionando como esperado

  • Cron */6 horas mas com offset?

  • Como recuperar crontab excluído

  • Auto-SSH funciona manualmente, mas não em segundo plano

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve