bsher
asked on
tar inside cron
hi,
i would like to backup some file everyweek
0 0 * * 0 tar -cvf abc.tar abc;gzip abc.zip
i would not replace the abc.zip,
thats mean the next week backup will become abc.zip1 ....abczip2........
how?
btw, is the any way beside '0 0 * * 0 tar -cvf abc.tar abc;gzip abc.zip' ?
thanx
i would like to backup some file everyweek
0 0 * * 0 tar -cvf abc.tar abc;gzip abc.zip
i would not replace the abc.zip,
thats mean the next week backup will become abc.zip1 ....abczip2........
how?
btw, is the any way beside '0 0 * * 0 tar -cvf abc.tar abc;gzip abc.zip' ?
thanx
ASKER
i tried this way but failed
tar -cvf /home/abc/backup.tar
/home/abc/file/*.txt
/home/abc/file/data/*.txt;
name=backup.tar;extent='da te+%W';
name=${name}$extent;
gzip /home/abc/$name
home/abc/file/word.txt
home/abc/file/time.txt
home/abc/file/data/mail.tx t
home/abc/file/data/user.tx t
/home/abc/backupdate+%W: No such file or directory
i would like to backup the *.txt from 2 different dir
once a week , eg:
1 nov 99 backup.tar.gzip.1
7 nov 99 backup.tar.gzip.2
backup.tar.gzip.1
14 nov 99 backup.tar.gzip.3
backup.tar.gzip.2
backup.tar.gzip.1
thanx
bsh
tar -cvf /home/abc/backup.tar
/home/abc/file/*.txt
/home/abc/file/data/*.txt;
name=backup.tar;extent='da
name=${name}$extent;
gzip /home/abc/$name
home/abc/file/word.txt
home/abc/file/time.txt
home/abc/file/data/mail.tx
home/abc/file/data/user.tx
/home/abc/backupdate+%W: No such file or directory
i would like to backup the *.txt from 2 different dir
once a week , eg:
1 nov 99 backup.tar.gzip.1
7 nov 99 backup.tar.gzip.2
backup.tar.gzip.1
14 nov 99 backup.tar.gzip.3
backup.tar.gzip.2
backup.tar.gzip.1
thanx
bsh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you are over complicating the problem
tar czvf abc.tgz`date +%V` abc
will create abc.tgzWEEKNUMBEROFYEAR
but tar czvf abc`date +%V`.tgz will prolly look cleaner.
will do the trick. note that the ` is a BACKTICK, it is NOT a ' or a ´
tar czvf abc.tgz`date +%V` abc
will create abc.tgzWEEKNUMBEROFYEAR
but tar czvf abc`date +%V`.tgz will prolly look cleaner.
will do the trick. note that the ` is a BACKTICK, it is NOT a ' or a ´
0 0 * * 0 tar -cvf abc.tar abc;name=abc.zip;extent=`d
that create each week a backup zipped with the extent is suffixed with the numero of the week in the year
format options of date:
.....
U Week number of the year (Sunday as the first day of the week) as a
decimal number in the range 00 - 53
W Week number of the year (Monday as the first day of the week) as a
decimal number in the range 00 - 53
X Current time, as defined by the locale
Y Year (including century), as decimal numbers
Z Timezone name, or no characters if no timezone exists
a Abbreviated weekday - Sun to Sat
b Abbreviated month name
c current date and time, as defined by the locale
d Day of month - 01 to 31
.....
(see man pages of date)