|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
hello, im a newbie in unix scripting. can someone pls send me a sample script that will tar files in the folders of a specific directory, but will exclude specific files, and afterwards, will ftp the tar into another server.
for example: in this directory, pshrprod:/opt/psoft/weblogic/818sp9_80 the following files and folders will be tar'd (this are not all the files/folders in this directory) copyright.html license.txt license.html classes --this folder also has files inside-- src but will exclude these files in these directories: Please exclude (aonprod08)pshrprod:/opt/psoft/weblogic/818sp9_80/psftaccess.log and /opt/psoft/weblogic/818sp9_80/myserver/access.log my question is: if the files will be tar'd where will the tar file be located? also, can the specific date and time of the run of the script be included? hope someone out there replies to me ASAP. thanks a lot |
|
#2
|
|||||
|
|||||
|
Re: help in creating script to make tar file
Quote:
The --exclude-from=FILE option that is part of tar is one option. $ tar cf some.tar --exclude-from=/some/path/exclude_me * This will tar all (* at the end) except for the files mentioned in/home/joe/exclude_me. Under unix/linux, the term 'files' also include directories. So if you put these two lines: /opt/psoft/weblogic/818sp9_80/psftaccess.log /opt/psoft/weblogic/818sp9_80/myserver/access.log inside a file and use tar with the --exclude-from=file option, these wioll not be tarred. Quote:
Where you tell it to: $ tar cf /data/backup/todays_backup.tar * todays_backup.tar is placed in /data/backup/ $ tar cf todays_backup.tar * todays_backup.tar is placed in present working directory See man tar for more options/explanations. Quote:
The date command can give you just about any date format you can think of. $ date '+%d%m%Y' 02122003 Prints present day, month and year. Put this in a variable and use that to create the name of your tarred file. #!/bin/bash # Fill variable with current day, month and year (ddmmyyyy) DATESTAMP="`date '+%d%m%Y'`" # tar everything in current directory and put this into a file with current date attached to it and place this file in /tmp tar cf /tmp/todays_backup.tar.${DATESTAMP} * This should be enough to get you going :-) |
|
#3
|
|||
|
|||
|
is it also possible to include in the script something that will make it run at a specific day and time?
thanks! |
|
#4
|
|||
|
|||
|
|
|
#5
|
|||
|
|||
|
hello again, follow up question on the 1st reply:
how do i open a tar file? its a simple file.tar that i need to open. thanks a lot |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > help in creating script to make tar file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|