Move all .log except those generated in the last 5 minutes
RHEL 5.8
In the directory /u03/pkms/app_logs I have several hundreds of log files as shown below.
Code:
$ pwd
/u03/pkms/app_logs
$ ls -alrt *.log | tail -50
-rw-r----- 1 oracle dba 9439232 May 4 13:57 mvtpcem_1_722892404_94157.log
-rw-r----- 1 oracle dba 9227264 May 4 13:57 mvtpcem_1_722892404_94158.log
-rw-r----- 1 oracle dba 9216000 May 4 13:57 mvtpcem_1_722892404_94159.log
-rw-r----- 1 oracle dba 9056256 May 4 13:57 mvtpcem_1_722892404_94160.log
-rw-r----- 1 oracle dba 10231296 May 4 13:57 mvtpcem_1_722892404_94161.log
-rw-r----- 1 oracle dba 9932800 May 4 13:57 mvtpcem_1_722892404_94162.log
-rw-r----- 1 oracle dba 10440192 May 4 13:57 mvtpcem_1_722892404_94163.log
-rw-r----- 1 oracle dba 10412032 May 4 13:57 mvtpcem_1_722892404_94164.log
-rw-r----- 1 oracle dba 9217024 May 4 13:57 mvtpcem_1_722892404_94165.log
-rw-r----- 1 oracle dba 10384384 May 4 13:57 mvtpcem_1_722892404_94166.log
-rw-r----- 1 oracle dba 9237504 May 4 13:57 mvtpcem_1_722892404_94167.log
-rw-r----- 1 oracle dba 9022464 May 4 13:57 mvtpcem_1_722892404_94168.log
-rw-r----- 1 oracle dba 9708032 May 4 13:57 mvtpcem_1_722892404_94169.log
-rw-r----- 1 oracle dba 9963008 May 4 13:57 mvtpcem_1_722892404_94170.log
-rw-r----- 1 oracle dba 10061312 May 4 13:58 mvtpcem_1_722892404_94171.log
-rw-r----- 1 oracle dba 10278400 May 4 13:58 mvtpcem_1_722892404_94172.log
.
.
.
<snipped for readability>
.
-rw-r----- 1 oracle dba 304128 May 4 14:13 mvtpcem_1_722892404_94199.log
-rw-r----- 1 oracle dba 1370112 May 4 14:21 mvtpcem_1_722892404_94200.log
-rw-r----- 1 oracle dba 337920 May 4 14:25 mvtpcem_1_722892404_94201.log
-rw-r----- 1 oracle dba 18944 May 4 14:26 mvtpcem_1_722892404_94202.log
-rw-r----- 1 oracle dba 5632 May 4 14:26 mvtpcem_1_722892404_94203.log
-rw-r----- 1 oracle dba 1024 May 4 14:26 mvtpcem_1_722892404_94204.log
-rw-r----- 1 oracle dba 1024 May 4 14:26 mvtpcem_1_722892404_94205.log
-rw-r----- 1 oracle dba 1024 May 4 14:26 mvtpcem_1_722892404_94206.log
I want to move all .log files to another location /u05/nmbs/may13, but skip those .log files which was
generated within the last 5 minutes. How can I do this ?
Hi
I need to get the last generated file in a directory using ls -ltr. I need to store the output of ls -ltr in a variable.
it will like this
$xyz = -rw-rw-r-- 1 sblp003 siebel 1060 Dec 18 13:33
from this output, I need to do a substring to get this value alone "Dec 18... (8 Replies)
Hi,
I need to move a certain number of files every 10 minutes from one folder to another. I have written the script below, however its not working, please advise.
#! /bin/ksh
start()
{
mv /test1/$(head -1000 /movetst) /test2/
sleep 600
}
stop()
{
exit
}
ls ti* >... (1 Reply)
I'm using Ubuntu and I have a text file I want to FTP to a web server every 5 minutes. I want to overwrite the existing file every time so I don't have tons of the same file. (10 Replies)
HI All,
I have a log file where the logs will be in the format as given below:
2011-05-25 02:32:51 INFO PROCESS STARTING
2011-05-25 02:32:52 INFO PROCESS STARTED
.
.
.
I want to retrieve only the logs which are less than 5 mins older than current time using grep... (3 Replies)
Dear Guru's
I've a requirment to grep for a string in series of log files that are getting generated almost every minute.
I'm looking to schedule a script every 15 mountes,in order to check if the error string has been generated in any of the log files generated in last 15 minutes.
Please... (3 Replies)
Team,
I have prepared a script which I run from my remote machine(Jump-box)server
Below is the script
FILEDATE=`date +%F`
LOGFILE=/home/abc/scripts/xyz.$FILEDATE.log
find /home/abc/scripts/xyz.*.log -type f -mtime -3 -delete
touch $LOGFILE
exec 1>$LOGFILE 2>&1
#healthcheck batch runs... (1 Reply)
Hi, please help with below time conversion to minutes.
one column values:
2 minutes 16 seconds 420 msec
43 seconds 750 msec
0 days 3 hours 29 minutes 58 seconds 480 msec
11 seconds 150 msec
I need output in minutes(total elapsed time in minutes) (2 Replies)
Hi all,
System Ubuntu 16.04.3 LTS
i have the following log
INFO 2019-02-07 15:13:31,099 module.py:700] default: "POST /join/8550614e-3e94-4fa5-9ab2-135eefa69c1b HTTP/1.0" 500 2042
INFO 2019-02-07 15:13:31,569 module.py:700] default: "POST /join/6cb9c452-dcb1-45f3-bcca-e33f5d450105... (15 Replies)
Discussion started by: charli1
15 Replies
LEARN ABOUT NETBSD
ching
CHING(6) BSD Games Manual CHING(6)NAME
ching -- the book of changes and other cookies
SYNOPSIS
ching [hexagram]
DESCRIPTION
The I Ching or Book of Changes is an ancient Chinese oracle that has been in use for centuries as a source of wisdom and advice.
The text of the oracle (as it is sometimes known) consists of sixty-four hexagrams, each symbolized by a particular arrangement of six
straight (---) and broken (- -) lines. These lines have values ranging from six through nine, with the even values indicating the broken
lines.
Each hexagram consists of two major sections. The Judgement relates specifically to the matter at hand (e.g., ``It furthers one to have
somewhere to go.'') while the Image describes the general attributes of the hexagram and how they apply to one's own life (``Thus the
superior man makes himself strong and untiring.'')
When any of the lines have the values six or nine, they are moving lines; for each there is an appended judgement which becomes significant.
Furthermore, the moving lines are inherently unstable and change into their opposites; a second hexagram (and thus an additional judgement)
is formed.
Normally, one consults the oracle by fixing the desired question firmly in mind and then casting a set of changes (lines) using yarrow-stalks
or tossed coins. The resulting hexagram will be the answer to the question.
Using an algorithm suggested by S. C. Johnson, the UNIX oracle simply reads a question from the standard input (up to an EOF) and hashes the
individual characters in combination with the time of day, process id and any other magic numbers which happen to be lying around the system.
The resulting value is used as the seed of a random number generator which drives a simulated coin-toss divination. The answer is then piped
through nroff(1) for formatting and will appear on the standard output.
For those who wish to remain steadfast in the old traditions, the oracle will also accept the results of a personal divination using, for
example, coins. To do this, cast the change and then type the resulting line values as an argument.
The impatient modern may prefer to settle for Chinese cookies; try fortune(6).
DIAGNOSTICS
The great prince issues commands,
Founds states, vests families with fiefs.
Inferior people should not be employed.
SEE ALSO
It furthers one to see the great man.
BUGS
Waiting in the mud
Brings about the arrival of the enemy.
If one is not extremely careful,
Somebody may come up from behind and strike him.
Misfortune.
BSD May 31, 1993 BSD