09-03-2007
first of all I didn't like an infinete loop and remove in a function. I thing same thing become to me before. rm is a bit slower so it can do next line of code before finishing remove.
Are you sure that this code is running why ;
df -k | grep /cbmdata/00/gdd | tr -d '%' | \
read a b c d e other /*does nothing must be **/
e=`df -k |grep $dir |awk '{print $4}' |tr -d '%'`
what is ref no input in the code.I think you mean %70 or else
where is the ascending order of date ? You must change all code
for example
dir=/cbmdata/00/gdd
function ()
{
if [ `df -k |grep $dir |awk '{print $4}' |tr -d '%'` -gt $ref ]
then
rm -f $file
fi
}
ref=$1
for file in $dir/*
do
[ -s $dir/* ] && function $file
done
if you mean LOG01 is older date than LOG02 ?
than I will write that code tomorrow. I must live now
Last edited by fazliturk; 09-03-2007 at 12:10 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there any commands in UNIX, like isopen(),isclose() to know whether a file has been opened for read/write purpose.?
Thanks (3 Replies)
Discussion started by: Pal
3 Replies
2. UNIX for Dummies Questions & Answers
I have a UNIX daemon process that's been started by a parent process, an application server.
The behavior of this daemon process is to inherit and use the app
server's file descriptors (ports/sockets).
When I shutdown the app server, the daemon continues to run, because there may be other... (1 Reply)
Discussion started by: kunalashar
1 Replies
3. UNIX for Advanced & Expert Users
I am having a client/server application which will download files from server. If server has directories, it will create directories/sub directories and then download files. In this process, I observed that number of open files are more than 400 (which is approxmately same as number of dir/subdir... (1 Reply)
Discussion started by: satyam90
1 Replies
4. Windows & DOS: Issues & Discussions
I'm trying to setup a cron job for my brother that goes out to the web and retrieves an excel file and overwrites the existing copy on his desktop. The problem I'm facing is I have to kill the process (excel.exe) if the file is open while the batch file runs, otherwise, it will create another copy... (2 Replies)
Discussion started by: quattro20v
2 Replies
5. Solaris
Hi
want to know what file (descriptor+filename+socket) is being accessed by particular process on solaris.
Purpose : while running perf. test, needs to find where is the bottleneck.
We are providing concurrnet load for around 1 hr and needs to capture data related to file usage pattern... (1 Reply)
Discussion started by: raxitsheth
1 Replies
6. Programming
can someone provide an example, where if the parent process quits for any reason, then the child process will also close? (3 Replies)
Discussion started by: omega666
3 Replies
7. IP Networking
Hi,
I have read some forum theads about the open and close ports. some points are clear and it is not working on my machine or something am i missing?
I have commented out a port /etc/services, one application uses
then when i use the telnet <hostname> <port_blocked> it shows connected..... (1 Reply)
Discussion started by: balamv
1 Replies
8. Shell Programming and Scripting
Hi all,
I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file.
I have already prepared a list of files in the input file.
Kndly help me.
Thanks,
Prash (36 Replies)
Discussion started by: prash358
36 Replies
9. Shell Programming and Scripting
I would like to create the following script:
run a python script with setsid
python may or may not fail with exception
check if all of the group processes were terminated correctly
if not, kill the remaining processes
How can I do that?
Thanks a lot (3 Replies)
Discussion started by: ASF Studio
3 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have an input like the one below. What i wanted to achieved is to create a select statement based from that information
INPUTInsert into table_name (col1,col2,col3,col4,col5,DATE1,DATE2,col6,col7,col8,col9,col10,col11) values (6752,14932156,24,'ALL','Staff',to_date('04/17/2017... (6 Replies)
Discussion started by: ernesto
6 Replies
unlink(2) System Calls Manual unlink(2)
NAME
unlink - remove directory entry; delete file
SYNOPSIS
DESCRIPTION
The system call removes the directory entry named by the path name pointed to by path.
When all links to a file have been removed and no process has the file open, the space occupied by the file is freed and the file ceases to
exist. If one or more processes have the file open when the last link is removed, only the directory entry is removed immediately so that
processes that do not already have the file open cannot access the file. After all processes close their references to the file, if there
are no more links to the file, the space occupied by the file is then freed and the file ceases to exist.
RETURN VALUE
returns the following values:
Successful completion.
Failure.
is set to indicate the error.
ERRORS
If fails, is set to one of the following values:
Search permission is denied for a component of the path prefix.
Write permission is denied on the directory containing the link to be removed.
The process does not have read/write access permission to the parent
directory.
The entry to be unlinked is the mount point for a mounted file system.
path points outside the process's allocated address space. The reliable detection of this error is implementation dependent.
Too many symbolic links were encountered in translating the path name.
The length of the specified path name exceeds
bytes, or the length of a component of the path name exceeds bytes while is in effect.
The named file does not exist (for example,
path is null or a component of path does not exist).
A component of the path prefix is not a directory.
The directory containing the file to be removed
has the sticky bit set and neither the containing directory nor the file to be removed are owned by the effective user ID.
The named file is a directory and
the effective user ID is not a user with appropriate privileges. Some file systems return this error whenever the named file
is a directory, regardless of the user ID.
The directory entry to be unlinked is part of a read-only file system.
The entry to be unlinked is the last link to a pure procedure
(shared text) file that is being executed.
WARNINGS
If is used on a directory that is not empty (contains files other than and the directory is unlinked, the files become orphans, and the
directory link count is left with an inaccurate value unless they are linked by some other directory.
If is used on a directory that is empty (contains only the files and the directory is unlinked, but the parent directory's link count is
left with an inaccurate value.
In either of the above cases, the file system should be checked using (see fsck(1M)). To avoid these types of problems, use instead (see
rmdir(2)).
SEE ALSO
rm(1), close(2), link(2), open(2), rmdir(2), remove(3C), privileges(5).
STANDARDS CONFORMANCE
unlink(2)