02-04-2008
unix script to check whether particular file exists and to find its size
I want to find the size of particular file exists in a particular directory
and i wnt to zip it.
In the below mentioned code it should check the MQ.log in the
particular directory.Please correct my code so that it will check
for particular MQ.log but i could not able to check whether
the MQ.log exist and please tell me the way to check the file size also
ROTATE_FILES="/apps/Mesa/Logs/AE/AE_logs/test"
REAL_FILE="MQ.log"
function rotate_files()
{
for j in $1;do
if [ -d $j ];then
for i in `ls -a /$j`;do
if [ $i=MQ.log ];then
echo $i
$FILESIZE = `ls -l $i|awk '{print $5}'`
$LIMIT = 0
if [ $i -ge 0 ];then
echo "the size is greater"
fi
fi
done
fi
done
}
rotate_files "$ROTATE_FILES"
Last edited by Balachandar; 02-04-2008 at 06:32 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things:
STEP 1) Verify that the file arrived in morning.
STEP 2) Compare the file size of the current... (3 Replies)
Discussion started by: rbknisely
3 Replies
2. Shell Programming and Scripting
So I have a lot of Java applications on my servers all having their own folder from the applications subdirectory. Now, I need to do the following.
Search all the applications subdirectories for message.jar.
If the message.jar file exists, I need to search the application directory for... (1 Reply)
Discussion started by: mmdawg
1 Replies
3. Shell Programming and Scripting
Please could anyone provide me the Command/script to find the size and usage of Unix box ASAP ? (6 Replies)
Discussion started by: sakthifire
6 Replies
4. UNIX for Advanced & Expert Users
Anybody can help
HOW TO FIND THE FILE SIZE IN UNIX (5 Replies)
Discussion started by: lmraochodisetti
5 Replies
5. Shell Programming and Scripting
Hi All,
working on AIX 5.3.
Requirement is:
Shell script in ksh to check if any file exists in 4 folders as below:
1. /FILE/INB/INT1
2. /FILE/INB/INT2
3. /FILE/INB/INT3
4. /FILE/INB/INT4
Thanks a lot for your time!
a1_win. (3 Replies)
Discussion started by: a1_win
3 Replies
6. Shell Programming and Scripting
guys,
I am trying to write a script that does the following:
it looks for a file in a specific directory and if the file is not there (NOT), it emails me. I have tried the following but its not working. It simply hangs up. Please help.
if
then
mail -s 'blah blah blah' my email... (4 Replies)
Discussion started by: basisvasis
4 Replies
7. Shell Programming and Scripting
Hi,
I am looking for a shell script with the following.
1. It should check whether a particular file exists in a location
#!/bin/sh
if ;
then
echo "xxx.txt File Exists"
else
echo "File Not Found"
fi
2. If file exists, it should check for the modified date and run a command... (2 Replies)
Discussion started by: karthikeyan_mac
2 Replies
8. Shell Programming and Scripting
Hi,
I am trying to write a script which checks if any file exists with "*.log" or "*.out" in Directory
below is the code
#------------------
path=/abd/xyz/
if ; then
echo "Good"
else
echo "Failure"
fi
#--------------------------
its always going to else part and printing... (8 Replies)
Discussion started by: ch33ry
8 Replies
9. Shell Programming and Scripting
Dear members, The following expect script connects to remote node and check for the file "authorized_keys" in directory /root/.ssh in remote node. However the result is always found even if the file exist or doesn't exist.
expect {
"$fname" {
send_user "found\n"
}
Any idea what is... (4 Replies)
Discussion started by: Sudhakar333
4 Replies
10. Shell Programming and Scripting
Hi All,
I am a beginner in this and trying to write a shell script in linux which will :
1. Ask for a file name and check if its exists.
2. If file exists only then it will ask for the new target folder, after entering target folder name it will check if it exists.
3. If target folder... (3 Replies)
Discussion started by: ashish_neekhra
3 Replies
pppoec(1) General Commands Manual pppoec(1)
NAME
pppoec - PPPoE (Point to Point Protocol over Ethernet) client
SYNOPSIS
interface-name
interface-name config-file] debug-level] log-file] retry-number]
DESCRIPTION
discovers an access concentrator that is willing to offer services to the client. It obtains a unique session-id from the selected access
concentrator. then forks a daemon which performs the session phase functionalities of PPPoE as mentioned in RFC 2516.
Options
supports the following options:
Specify the configuration file with absolute path
to be used by The default configuration file is
Specify the debug level at which logging has to be
enabled. The three debug levels are:
Logs all error messages.
To log these messages, type on the command line.
Logs all warning messages.
To log these messages, type on the command line.
Logs function level debug messages.
To log these messages, type on the command line.
Specify the name of the network interface (e.g.,
to be used for the PPPoE session.
Specify the log file with absolute path, to which pppoec must
log all messages. The default log file is
Specify the frequency of PADI (PPPoE Active
Discovery Initiation) or PADR (PPPoE Active Discovery Request) packet retransmission when an access concentrator
does not respond to the client's request. The default value is 3.
EXAMPLES
An example usage of the command is as follows:
WARNINGS
Note that, you cannot run the client daemon without file. See pppoec.conf(4) for more information. Also, do not use to terminate Instead,
use to kill the client daemon.
AUTHOR
was developed by Hewlett-Packard.
FILES
PPPoE server daemon
PPPoE relay
PPPoE client configuration file
PPP daemon
SEE ALSO
pppd(1), pppoerd(1M), pppoesd(1M), pppoec.conf(4).
pppoec(1)