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 / server / Perguntas / 1166235
Accepted
Setyawan
Setyawan
Asked: 2024-10-07 09:04:23 +0800 CST2024-10-07 09:04:23 +0800 CST 2024-10-07 09:04:23 +0800 CST

Quero reiniciar o serviço vsftpd todos os dias às 6:00 da manhã, mas esse script reinicia o serviço a cada minuto das 6h às 7h. O que devo fazer?

  • 772

Aqui está o temporizador vsftpd-restart.timer

[Unit]
Description=Restart vsftpd daily at 6 AM
After=network.target

[Timer]
Unit=vsftpd-restart.service
OnCalendar=*-*-* 06:00:00
Persistent=true

[Install]
WantedBy=timers.target

Este é o script vsftpd-restart.service

[Unit]
Description=Restart vsftpd daily at 6 AM
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'systemctl stop vsftpd; systemctl start vsftpd'

[Install]
WantedBy=vsftpd-restart.timer

E aqui está o log systemctl vsftpd

Oct 07 06:00:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:00:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:00:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:00:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:00:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:01:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:01:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:01:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:01:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:01:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:02:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:02:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:02:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:02:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:02:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:03:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:03:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:03:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:03:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:03:02 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:04:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:04:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:04:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:04:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:04:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:05:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:05:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:05:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:05:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:05:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:06:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:06:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:06:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:06:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:06:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:07:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:07:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:07:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:07:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:07:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:08:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:08:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:08:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:08:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:08:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:09:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:09:01 test systemd[1]: vsftpd.service: Deactivated successfully.
Oct 07 06:09:01 test systemd[1]: Stopped vsftpd.service - vsftpd FTP server.
Oct 07 06:09:01 test systemd[1]: Starting vsftpd.service - vsftpd FTP server...
Oct 07 06:09:01 test systemd[1]: Started vsftpd.service - vsftpd FTP server.
Oct 07 06:10:01 test systemd[1]: Stopping vsftpd.service - vsftpd FTP server...
Oct 07 06:10:01 test systemd[1]: vsftpd.service: Deactivated successfully.
ubuntu
  • 1 1 respostas
  • 39 Views

1 respostas

  • Voted
  1. Best Answer
    Zhivko Zhelev
    2024-10-07T13:00:05+08:002024-10-07T13:00:05+08:00

    O motivo pelo qual sua configuração atual está fazendo com que o serviço vsftpd reinicie a cada minuto das 6:00 às 7:00 da manhã é devido ao temporizador OnCalendar= - -* 06:00:00 ser persistente (Persistent=true). Isso significa que o temporizador tenta "recuperar" eventos perdidos durante o tempo em que o sistema estava desligado, então se o sistema estava desligado às 6 da manhã, isso pode levar a vários gatilhos quando o sistema voltar a ficar online. Isso deve resolver:

    vsftpd-restart.timer

    [Unit]
    Description=Restart vsftpd daily at 6 AM
    After=network.target
    
    [Timer]
    Unit=vsftpd-restart.service
    OnCalendar=*-*-* 06:00:00
    AccuracySec=1min  # Optional: Adds a margin to avoid precision issues
    Persistent=false  # Ensures it only triggers at the exact time and doesn't catch up on missed triggers
    
    [Install]
    WantedBy=timers.target
    

    E não se esqueça de recarregar com o novo script do timer:

    sudo systemctl daemon-reload
    sudo systemctl restart vsftpd-restart.timer
    
    • 1

relate perguntas

Sidebar

Stats

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

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 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