Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
Accidentally failing command in linux

I have server and connect to it via ssh, I would like to run command and then disconnect from server thinking, that process is running and will be finished in few hours. So I came up with

python script.py > output.txt 2^C1 & 

it works! ... well sometimes .. and sometimes (exactly the same python script) it fails without leaving any error msg in output.txt. Does anyone know why? And what should I be running to prevent failing?

I doubt that it has something to do with python script.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You're probably looking for nohup.

nohup python script.py > output.txt 2^C1 &

It allows you to logout with the script still running.

over 4 years ago · Santiago Trujillo Relatório

0

It won't leave any error message in output.txt, Try this

python script.py 1> output.txt 2>error.txt 2^C1 &

If your script fails it should log reason in error.txt

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda