I'm trying to setup a cron job to archive/backup
/home/username/.mozilla/ directory and all its sub-directories, including hidden files, using tar. I like to run the job at 12:01 AM every night.
Here's what I have planned so far:
crontab -e 1 0 * * * tar -zcf /home/username/Dropbox/Backups/Firefox_Profile_$(date +%b_%d_%Y_"%H-%M").tgz home/username/.mozilla/ && echo "Firefox profile backed up on:" `date` >> /home/username/jobs
Though I have not actually setup the cron job yet, when I run this command in terminal:
tar -zcf /home/username/Dropbox/Backups/Firefox_Profile_$(date +%b_%d_%Y_"%H-%M").tgz home/username/.mozilla/
it does create a compressed archive, but upon exctraction, it creates a directory
.mozilla and its sub-directories.
What I am looking for is:
(1) upon extraction there would be either
.mozilla or preferably
mozilla (removing the dot), and its sub-directories, including hidden files (no
tar -zcf the best way to get maximum compression.
(3) keep all the file permissions as it is.
(4) do I need to have [user] (which is "username") in this command:
1 0 * * * username tar -zcf
Thanks a lot.