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

487
Visualizações
How can I remove the particular line in crontab?

below mentioned script has my crontab running functions.

# Chef Name: binary_log_purge 0 */4 * * * /engineyard/bin/binary_log_purge -q
# Chef Name: database_oom_score
*/30 * * * * /engineyard/bin/database_oom_adj
# Chef Name: logrotate -f /etc/logrotate.d/stats 0 * * * * logrotate -f /etc/logrotate.d/stats
# Chef Name: cpu_utilaisation
*/5 * * * * cd /tmp && sh cpu_util.sh >> cpu_utilaisation.log
# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

The above mentioned query i want to remove the blow line

# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

How can i remove the function with below mentioned steps:

Step 1 : first i want to find the below line is there or not. How can i find out?

*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

Step 2 : If the line is there. I want to remove the function. How can i remove the function ?

Please help me.....

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

0

According to man 5 crontab the crontab files are not intended to be edited directly.

What you can do is run crontab -l, filter out the line using grep -v, run crontab -r to clear the crontab then pipe the modified version of the crontab file into crontab -.

over 4 years ago · Santiago Trujillo Relatório

0

You can use grep -A 1 'Chef Name: Test_script' | grep -v "^#" to get the line after Test_script but ignoring commented out lines.

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