I have prepared a script to find the log file based on a date range defined in one of the environment files, archive the logs files and move them to a particular directory.
Below is the script:
But when I try to run this script, i am getting the following error:
I am clueless about these 2 errors. Please let me know the issue with the script.
The problem with your tar command is that
Should just be
However, I can't see what you want to achieve by piping a long directory listing into the standard input of tar. Perhaps you should be using cpio instead of tar and using 'find ... -print' instead of 'find ... -exec ls -l {} \;'
find . -name "*.bin" -type f -mtime +$file_arch_st_time -mtime -$file_arch_end_time
find . -name "*.bin" -type f -mtime +$file_arch_st_time -mtime -$file_arch_end_time -exec ls -l {} \;
find . -name "*.bin" -type f -mtime +$file_arch_st_time -mtime -$file_arch_end_time -exec ls -l {} \;
All three of these "find" make no sense even though they are not a syntax error (after syntax correction).
With respect to the values if $file_arch_st_time and $file_arch_end_time what (in words) are the commands intended to do?
Quote:
find the log file based on a date range defined in one of the environment files
Thanks Anurag for your suggestion. It fixed the problem. But now i run into a different issue. Somehow i am not able to uncompress/untar the compressed file.
It gives the below error.
Kevin,
Is it because of the issue you highlighted?
Also I read in one of the article that the cpio has a limitation of max 2 GB for each file. But my files might be more than 2 GB in some scenarios.
Sam
---------- Post updated at 04:44 PM ---------- Previous update was at 04:40 PM ----------
@methyl
Suppose, I defined the values for below variables in my environment file as
file_arch_st_time=7
file_arch_end_time=14
then the script substitutes the above values and finds the files between 7 and 14 days. Please let me know if this incorrect way of writing the script
Your gtar command says:
Which means create a tar archive of the file called filename and store it in the file called filename, ie. the same file, so you get the error 'file is the archive.'
The 2GB file size limit is a limit of 32 bit versions of linux, not cpio, so you would get the same limit with tar. However, if you use compression, as you are trying to do, it would be the compressed file that would need to be less than 2GB. By the way, if you want to create a compressed tar file you would use:
You don't pipe tar to compress, you can pipe cpio to compress.
I am trying to install VirtualBox on RHEL 5 but I need the 32 bit version for 32 bit Windows. When I run yum I get the following:
sudo yum localinstall /auto/spvtg-it/spvss-migration/Software/VirtualBox-4.3-4.3.2_90405_el6-1.i686.rpm
Loaded plugins: fastestmirror
Setting up Local Package... (13 Replies)
Hello,
This is a programming question as well as a suse question, so let me know if you think I should post this in programming.
I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
hi,
if I exectute "nohup time ls -1" I get the following output
$ nohup time ls -1
file_1
file_2
file_3
file_4
file_5
0.000u 0.001s 0:00.00 0.0% 0+0k 0+0io 0pf+0w
This is all OK.
But if I want to capture this whole output in to a text file I would want to use something like
... (1 Reply)
Hi,
I am getting this error while running the following code.
i=`awk '{print $2}' test1.txt`
j=`awk '{print $4}' test1.txt`
k=`awk '{print $6}' test1.txt`
if ; then
echo "Up."
else
echo "down"
fi
rm -f test.txt test1.txt
error is this:
line 12: '
Please suggest. (2 Replies)
I got rather bored so i decided to create a script that creates a countdown, and shows hours:minutes:seconds till that time.
It works fine until the seconds of the actual time reaches 8, then it tries to use it to work out the difference as in "SECONDDIFF=$"
Here's my code where I get the... (12 Replies)
Hi, so I have been trying to write a shell script to go through a log file and through that, generate another file with all the Valid IP addresses it finds. So there's the complication that there could be incomplete or invalid data which would disqualify it from making my "Valid IPs" file I need... (3 Replies)
I need to your help. I want write a script search for rows in file1 if exist in file2 it will print rows from file2 else it will print rows from file1 with out any duplicate
... (4 Replies)
Hi All,
I have a server running SunOS 5.9, on this I need to install Oracle 10g; however the installer returns
ERROR: Unable to convert from "UTF-8" to "646" for NLS!
Did some digging around and found that I need the SUNWuiu8 package.
However I'm not sure where I can download the... (1 Reply)
I have the following portion of a script
Check()
{
echo "\n\nChecking that all constraints are Enabled"
echo "..."
sleep 2
CHECK_COUNT='sqlplus -s $1 <<-EOSQL4
set feed off pause off pages 0 head off;
set linesize 150 echo off;
select count(*) from user_constraints where... (4 Replies)