Need some tar backup and archiving help

Operandi

Diamond Member
Oct 9, 1999
5,508
0
0
First off I should mention that this is for a Linux class that I'm taking, I'm not actually backing anything up. I missed a class last and would like to get caught up for this week and this is the last part of the lab. There are two things left; they don't seem like they should be that hard, but I'm having problems.

1. I have to backup a directory along with it's subdirectories and files to a tar file that will be placed in "/backup". This has to be done in the terminal and apparently has something to do with the 'cpf" parameters but I'm having problems with syntax.

2. The last step is schedule a daily backup a backup via cron. The backup should also be logged to specific file.

Any help from you Linux experts would be appreciated.
 

Operandi

Diamond Member
Oct 9, 1999
5,508
0
0
This is the command I'm running and I'm getting an error "tar -cpf /data /backup/backup.tar".

Obviously I must be doing something wrong.

**figured it out** I had the syntax backwards, stupid mistake. Now I just need to figure out how to schedule the backup.
 

Operandi

Diamond Member
Oct 9, 1999
5,508
0
0
Ok, so the backup is supposed to happen every day at 6:30 except for Sundays.

This is what I'm going to place in my crontab file "30 18 * * 1,2,3,4,5,6 tar -cpf /backup/databack.tar /data > /var/log/warlickcron.log"

Dose that look right?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Tar is probably one of the worst tools out there for syntax, it's very picky and uses just about every letter for one option for another. Anything out of the ordinary (cvpf to create and xvpf to extract usually with a z or j thrown in for compression) and I have to break out the man page to find what I'm looking for.

And the crontab syntax is annoying too, but it looks like you got it figured out as well. If you run 'man 5 crontab' it'll show you the man page for the crontab file format. For GNU crontab you could've also done '1-6' for the days to save typing but what you have should work fine.
 

Operandi

Diamond Member
Oct 9, 1999
5,508
0
0
Well I changed the time syntax to 2 * * * * tar -cpf /backup/databack.tar /data so it would run ever 2 mins as test but it doesn't seem to be running, no tar file is created.

I know the tar command is correct because when I run the command by itself the backup is created.

Any ideas?