LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2006, 09:31 AM   #1
bennethos
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: -- Slackware for servers -- Debian for desktops --
Posts: 124

Rep: Reputation: 16
silly bash question


Hi,

i use fetchmail to pop my mail and would have liked to archive it each month

so i added a cron that runs each 1st of the month to backup that large mail file.

the bash script looks like this :
----------
mariko:~# cat mail_archive.sh
#!/bin/bash

date=`date +_%d_%m_%Y`
#echo $date
tar cvf /home/benjamin/mail_backup/mail"$date".tar.gz /var/mail/benjamin
-----------

the file /var/mail/benjamin is my fetchmail file that contains all the mail.

when i check the dir /home/benjamin/mail_backup/ it contains a neat file with the date an all.

problem is i cant untar it

if i execute tar zxf mail_18_02_2006.tar.gz it says :

mariko:/home/benjamin/mail_backup# tar zxf mail_18_02_2006.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

Hope you guys can help me out

thx in advance
 
Old 03-25-2006, 09:46 AM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
You created a tar archive - with no compression!
to create a gzipped tar archive - add the -z switch to your script

Code:
#!/bin/bash

date=`date +_%d_%m_%Y`
#echo $date
tar cvfz /home/benjamin/mail_backup/mail"$date".tar.gz /var/mail/benjamin
file mail_18_02_2006.tar.gz
should confirm that it is a tar archive - without compression really - it's just the name which suggests that it is compressed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
silly question NePt Mandriva 5 02-21-2005 03:31 PM
silly bash/aterm ctrl+l question jipe Linux - General 0 01-05-2004 06:43 AM
Silly question? pudhiyavan Linux - Networking 1 12-09-2003 03:44 AM
Silly question that no one will like. xjester Linux - Newbie 9 11-17-2002 01:58 AM
Silly Question MattB Linux - Software 1 06-05-2002 11:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration