Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to check if a unix text file is being accessed? Post 26448 by rickylui on Monday 19th of August 2002 06:19:40 AM
Old 08-19-2002
How to check if a unix text file is being accessed?

I am writing a script that periodically reads in data from a text file. The only issue is that, that text file is periodically updated (appended to) by another script. I am using perl in UNIX environment. How can I check if that text file is being accessed, so I can wait until it is no longer being accessed before trying to access it. Know what I mean? Help woud be apprecated.

Ricky
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

list file which is accessed yesterday

how can I use 'ls' to list file which is accessed yesterday? Thx :confused: (2 Replies)
Discussion started by: aaron_fong
2 Replies

2. Shell Programming and Scripting

how can i check if text file is closed ?

Hello all im trying to make daemon that listen for incoming textiles and then it will move them to defined directory now the daemon part is ok but im stack on how to check of file is close and done copied to directory . so i could process it and move it forward tnx (13 Replies)
Discussion started by: umen
13 Replies

3. Shell Programming and Scripting

how to know which login file is being accessed

when unix is logged in it access some login file depending on the shell like .cshrc , .login , .vimrc , .bashrc how can we know which is being access in a perticular unix flavor. (1 Reply)
Discussion started by: useless79
1 Replies

4. Shell Programming and Scripting

Can we get the list of users who accessed a file

Hi all, I will thankful if anybody helps me in finding out the users who accessed any of our files. Thanks in advance Chanakya (2 Replies)
Discussion started by: Chanakya.m
2 Replies

5. AIX

File Accessed Alarm ??

Hey, I want to ask a simple Question.... How would I be able to come to know that files/directoires in a Parent directory has been accessed (means contents of the file has been just viewed) by the user(s) in a group ? and mail the name(s) of those files/directories which has been accessed... (1 Reply)
Discussion started by: varungupta
1 Replies

6. Shell Programming and Scripting

File Accessed Alarm ??

Hey, I want to ask a simple Question.... How would I be able to come to know that files/directoires in a Parent directory has been accessed (means contents of the file has been just viewed) by the user(s) in a group ? and mail the name(s) of those files/directories which has been accessed... (16 Replies)
Discussion started by: varungupta
16 Replies

7. Shell Programming and Scripting

check if file is being accessed by any application

Hello, is there maybe a way to check if a specific file is being accessed at the moment? Example: You will start copying a 10 GB file from A to B, how could I code it so my script actually knows when file B is finished copying? (1 Reply)
Discussion started by: TehOne
1 Replies

8. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

9. UNIX for Advanced & Expert Users

How to find out last 5 users who have accessed a file?

Hi All, is there any command or script to find out last five users who have accessed a file thanks jcpratap (1 Reply)
Discussion started by: Jcpratap
1 Replies

10. UNIX for Dummies Questions & Answers

File shows in ls but cannot be accessed

I can do an ls -l CD* and see the following CDTEST userA RW RW R and I an logged on as userA. But if I do an ls -l the file does not appear. If I do a vi CDTEST it tries to create a new file named CDTEST. If I do a mv or rm I get the message no file of name CDTEST found. Any idea what is going on.... (3 Replies)
Discussion started by: LeeT
3 Replies
DUREP(1)						    Disk Usage Report Generator 						  DUREP(1)

NAME
durep - disk usage report generator SYNOPSIS
durep [OPTIONS]... [DIRECTORY] DESCRIPTION
durep creates disk usage reports with bar graphs, allowing one to easily deduce which directories are using the most space. Although durep can produce text output similar to du, its real power lies in the ability to store reports in a file, which can then be viewed as a web page with the supplied cgi script. OPTIONS
Options are grouped into three distinct sections. Text Output Options These options are for controlling the text report output. -td, --text-depth=N Limit text report on directories to depth N. No directories below this level will be shown in the report. -hs, --hide-size=N[bkmg] Do not display entries using N Bytes/KB/MB/GB or less (default Bytes). This is to reduce clutter in the reports. It allows you to remove small files from the text report. -sd, --show-date Display the modification date of the file or directory in the report. -ns, --nosort Do not sort results by size. Leaves results in the order in which they were scanned, which is highly dependent on the file system. -q, --quiet Do not produce text output. This stops the creation of a text report, and is useful when you are only interested in generating a save-file for use with the web report. File Options These options control load and save files. -sf, --save-file=FILE Save the results of the scan into this file. This can be loaded for a text report, but is generally used by the cgi script to display web reports. The filename should end in .ds (it is appended if it does not). -lf, --load-file=FILE Load the results of a scan from this file. This takes the place of scanning a directory. Inclusion options (described below) will not take effect if this option is used. -d, --desc=DESCRIPTION Give a description to be stored in the save-file. This is displayed on the web report summary page. -c, --collate==DIR Collate the save-files in the given directory. This creates a durep.cds file, which is used by the cgi script to manage and display save-files. See Web Reports section below for more detail. Inclusion Options These options control which directories and files should be included in the report. -f, --files Do not descend into sub-directories, only report files. -x, --one-file-system Do not traverse file systems. This is similar to the -x option for du, allowing easy checking of an entire file system such as /. -cp, --collapse-path=PATTERN Hide entries below paths that match PATTERN. This allows you to conceal the contents of certain directories in the report. You may wish perhaps to show home directories in a report but not show their content in which case you could use the option "-cp '/home'". -ep, --exclude-path=PATTERN Ignore paths that match PATTERN. This works in a similar manner to "-cp" above, except it excludes the directory from the scan itself. -cf, --coalesce-files==N[bkmg] Coalesces entries for files below the given size into one entry. This is useful for reducing clutter in reports. WEB REPORTS
Since version 0.9, durep no longer directly generates html files for its web reports. It now uses a cgi script that reads data from save- files. The script will handle multiple save-files, potentially from multiple hosts, so you can consolidate your reports into one place. Copying save-files from other hosts is left as an exercise for the reader. It is necessary to collate the save-files before viewing them via the cgi script. This process creates the file "durep.cds" which contains meta-data about all of the save-files. From this a summary page is shown where you can choose which report you wish to view. The collation must be done any time a save-file is added or overwritten. The cgi-script has some configurable variables at the top. These tell the script where to look for the css file and the graphic used for the bar graphs. There are also options to set whether the modification date, and/or the options used to create the save-file should be shown. These are both set to 1 by default. As always, you should take care when installing the cgi script. I've done my best, but I make no guarantees about its security. It would probably be unwise to allow this script to be accessed from the Internet at large. EXAMPLES
1. durep -td 2 This would print the directory tree starting from the current directory to depth 2. 2. durep -f /var/spool/mail This might be useful for keeping a check on the mail directory. The "-f" switch tells durep to just scan files and not descend into directories. 3. durep -x -cp "/(etc|usr/share)" -ep "/var" -sf /var/lib/durep/root.ds / This more complicated version does the following. It scans the root file system only, collapses the contents of any paths beginning /etc or /usr/share and skips the contents of the /var directory. It saves the output of this report into the file /var/lib/durep/root.ds. No text report is produced. 4. durep -lf /var/lib/durep/root.ds -hs 1m This reads the save-file /var/lib/durep/root.ds and produces a text report from it, hiding any files below 1 megabyte. 5. durep -c /var/lib/durep This collates any save-files in /var/lib/durep. SEE ALSO
du(1), perl(1) AUTHOR
Damian Kramer <psiren@hibernaculum.net> durep version 0.9 2012-05-12 DUREP(1)
All times are GMT -4. The time now is 07:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy