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

247
Visualizações
How to use the tar command to copy my home directory

I was just wondering if this crontab would work to backup my home directory to a bkup directory every Saturday at 1230?

   30 12 * * 6 tar -cvf backup.tar $HOME | bkup/

Will that work?

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

0

Piping to bkup/ probably will not work as expected.

Perhaps you meant something like this:

30 12 * * 6 tar -cvf /bkup/backup.tar $HOME

where /bkup is a different directory tree than where $HOME resolves to (usually /home).

The time looks okay: 30 = minutes, 12 = hours, 6 = Saturday. You might have intended 1230 am, which would be 0 for hours. Most people do not run backups while they are working.

Running with the -v option, you will probably get lengthy messages from cron (I have about 26,000 files under my $HOME). So I would eliminate that option. The - on the option is not necessary, but works with GNU tar. By eliminating the verbosity, you can more easily notice error messages.

Most people would compress the backup, e.g., using the z (gzip) option.

Factoring in those comments (but leaving the time alone), you might have something like

30 12 * * 6 tar czf /bkup/backup.tar.gz $HOME

Finally (out of scope for the question), your backup will be writing to the same file, every Saturday. If you have enough space, you might investigate how to generate distinct names for your backups and accumulate 2-3 backups in the space that compressing the backups saved.

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