Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar command

Status
Not open for further replies.

Count430

Programmer
Apr 26, 2002
127
US
Hello All I must say as I move further into the Solaris Platform, this site has become very attractive.

I have a situation where logfiles generated from a cronjob
keep pushing my / to 100%

My question is, what kind of tar statment can I use to list
this files and re-direct them to a tar file in a new location.

Any help on this would be greatly appreciated.

Thanks in Advance.

 
You can try this:

Assume you have 3 files to tar up (cron1, cron2 and cron3) and your /home/urname directory is on the /home partition. You can do this:

"for t in cron1 cron2 cron3; do tar -cvf /home/urname/cronjobs.tar $t; done"

Quotation marks are for clarity, not part of the command. This forloop will collect each file named in the $t variable and add them to the cronjobs.tar file which will be stored in /home/urname (or whatever partition you choose). Once you've verified that the tar file exists where you want it you can verify that all the files you named in $t are in the tar file by doing "tar -tvf /home/urname/cronjobs.tar" which will list the all the files in the tar. Once you've verified the job worked as you wanted it, you can delete the files from the directory they lived in previously (here presumably / ).

Hope this helps. Meekness: Uncommon patience in planning a revenge that is worth while.
-- Ambrose Bierce
 
1) look that logfiles are not going to /
if / is full the sys hangs
if an other partition is full, the sys will just
complain about this.
make a new partition, say /dev/dsk/c?t?d?s?
and mount it on /mylogs, then let cron write to /mylogs
2) if you want transfer files
cd where-the-files-are
tar cfb - 126k the-files-you-want-move-or-dot |( cd the-dir-you-want-save-the-files ; tar xfpv -)
then rm -rf the-files-you-want-move vox clamantis in deserto.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top