The way I see it, I'm afraid there is no simple workaround for your problem. There is no such function not even in the glibc I guess. To do something like that, you would have to go through every processes' file descriptors (in /proc/onepid/fd for Linux) and check if there is no reference to one file inside that $SOMEDIR of yours.
Nowadays you shouldn't have to worry about those things because programs don't just write to files directly. The way to do it, is writing a temporary file and then rename() it to the location you want. rename() is an atomic function (will never corrupt the file).
In shell scripting, you could use
every minute to see what files were changed in the last minute.
Anyway, wait for more replies, there could be something that at least would get you close to what you want.
Hi all,
I have a directory where some process is keeping incremental/new log files. I need to code a program which will periodically poll this directory and if it founds a new file arrived then copy that new file to some other specific directory.
We are OK with this polling approach. I just... (3 Replies)
Hey guys,
I am working on a Cshell script and I am stuck on this one part. I need to be able to copy in files to my directory but give them different names so they don't overwrite each other. For example, my folder already contains FILE.1 I want my script to name the next file copied over... (5 Replies)
I have 20 or so files that are ftp'd each day to a particular directory. I want to create a script that will tell me if any of these files fails to arrive or if any additional files arrive. I'm thinking I'd have a list of file names that should arrive each day, and the script would check each days... (2 Replies)
Hi,
We have a filesystem mystery on our hands. Given:
2 machines, A and Aa.
Machine Aa is the problem machine.
Machine A is running Ubuntu, kernel 2.6.22.9 #1 SMP Wed Feb 20 08:46:16 CST 2008 x86_64 GNU/Linux. Machine Aa is running RHEL5.3, kernel 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38... (2 Replies)
I plan to run a script which will run in background and at predefined times send mails to user . I dont have acees to autosys/ Cron / at jobs
My loop works like this
while (true)
do
getx_time=`date +%H%M`
if ; then
script1.sh
mail_sent_flag=1
elif ; then
script2.sh... (1 Reply)
Hi!
Im trying to make a program that polls a mysqlDB every 5 minutes.
the poll checks a scheduletable in the dB and exicutes a function if
there was a "go" in the scheduletable, and if it retrives a "no go" from the table
it should just wait for another 5 minutes before re polling the DB,
... (1 Reply)
Hi Guys,
we are planning to enable polling target on our SG in reference to this link
MC/ServiceGuard: Subnet Goes Down when one of the Cluster Node is Down - HP Customer Care (United States - English)
since our server is already in production can we apply the changes with ex. "cmapplyconf... (1 Reply)
Hello All,
I have a script that checks a log file. This will be checked periodically lets say every 5 minutes. I need to get new entries and process these new entries
What do you think is the best strategy here? all i can think of currently is to backup the old file and do diff. But future... (9 Replies)
HI
I need some help on this below one
Have summuary file coming on daily basis with list of file names and count ,if the summuary file not exist ,pool it for every 5 mins till it arrives .Once arrived remove first and last line from the file and check all the files in respective director all... (12 Replies)
Discussion started by: mohan705
12 Replies
LEARN ABOUT LINUX
lp
LP(4) Linux Programmer's Manual LP(4)NAME
lp - line printer devices
SYNOPSIS
#include <linux/lp.h>
CONFIGURATION
lp[0-2] are character devices for the parallel line printers; they have major number 6 and minor number 0-2. The minor numbers correspond
to the printer port base addresses 0x03bc, 0x0378 and 0x0278. Usually they have mode 220 and are owned by root and group lp. You can use
printer ports either with polling or with interrupts. Interrupts are recommended when high traffic is expected, for example, for laser
printers. For usual dot matrix printers polling will usually be enough. The default is polling.
DESCRIPTION
The following ioctl(2) calls are supported:
int ioctl(int fd, LPTIME, int arg)
Sets the amount of time that the driver sleeps before rechecking the printer when the printer's buffer appears to be filled to arg.
If you have a fast printer, decrease this number; if you have a slow printer then increase it. This is in hundredths of a second,
the default 2 being 0.02 seconds. It only influences the polling driver.
int ioctl(int fd, LPCHAR, int arg)
Sets the maximum number of busy-wait iterations which the polling driver does while waiting for the printer to get ready for receiv-
ing a character to arg. If printing is too slow, increase this number; if the system gets too slow, decrease this number. The
default is 1000. It only influences the polling driver.
int ioctl(int fd, LPABORT, int arg)
If arg is 0, the printer driver will retry on errors, otherwise it will abort. The default is 0.
int ioctl(int fd, LPABORTOPEN, int arg)
If arg is 0, open(2) will be aborted on error, otherwise error will be ignored. The default is to ignore it.
int ioctl(int fd, LPCAREFUL, int arg)
If arg is 0, then the out-of-paper, offline and error signals are required to be false on all writes, otherwise they are ignored.
The default is to ignore them.
int ioctl(int fd, LPWAIT, int arg)
Sets the number of busy waiting iterations to wait before strobing the printer to accept a just-written character, and the number of
iterations to wait before turning the strobe off again, to arg. The specification says this time should be 0.5 microseconds, but
experience has shown the delay caused by the code is already enough. For that reason, the default value is 0. This is used for
both the polling and the interrupt driver.
int ioctl(int fd, LPSETIRQ, int arg)
This ioctl(2) requires superuser privileges. It takes an int containing the new IRQ as argument. As a side effect, the printer
will be reset. When arg is 0, the polling driver will be used, which is also default.
int ioctl(int fd, LPGETIRQ, int *arg)
Stores the currently used IRQ in arg.
int ioctl(int fd, LPGETSTATUS, int *arg)
Stores the value of the status port in arg. The bits have the following meaning:
LP_PBUSY inverted busy input, active high
LP_PACK unchanged acknowledge input, active low
LP_POUTPA unchanged out-of-paper input, active high
LP_PSELECD unchanged selected input, active high
LP_PERRORP unchanged error input, active low
Refer to your printer manual for the meaning of the signals. Note that undocumented bits may also be set, depending on your
printer.
int ioctl(int fd, LPRESET)
Resets the printer. No argument is used.
FILES
/dev/lp*
SEE ALSO chmod(1), chown(1), mknod(1), lpcntl(8), tunelp(8)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 1995-01-15 LP(4)