Sponsored Content
Top Forums Shell Programming and Scripting Unix script to detect new file entry in directory Post 302245355 by matrixmadhan on Friday 10th of October 2008 02:15:04 AM
Old 10-10-2008
Did you mean file system directory listeners ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP script for sending a file from one unix directory to another unix server director

Hi, My local server is :/usr/abcd/ Remote server is :/Usr/host/test/ I want to send files from local unix directory(All files starting with O_999) to remote host unix directory. Can any body give me the Unix Shell script to do this. One more doubt: Shall we need to change the file... (1 Reply)
Discussion started by: raja_1234
1 Replies

2. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: (Note: The symbol " was added to stop them being created into links) "www.google.com"... (1 Reply)
Discussion started by: ROFL
1 Replies

3. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: www.google.com www.facebook.com www.google.com the output should be: www.google.com x2... (2 Replies)
Discussion started by: ROFL
2 Replies

4. UNIX for Dummies Questions & Answers

Not able to delete this file/directory/entry

Hello UNIX gurus, I noticed this file or whatever in one of our directories, and somehow I am not able to proceed with my work, without deleting this one. .insert--- 1 siebload intrface 0 Feb 22 01:25 Testfile I am confused, as it doesnt appear to be a file, and on doing any... (2 Replies)
Discussion started by: ppathak1234
2 Replies

5. Shell Programming and Scripting

script to detect a file from inserted usb and puts into a Variable

There is a same named log file that I have on my 2 different android phones. When I plug it into my computer, it appears in the media folder, For example the first android phone: /media/F6BA-0AF5/folder/A.log I want to put that into a variable to be manipulated.... (3 Replies)
Discussion started by: tobenguyen
3 Replies

6. Shell Programming and Scripting

How to add each entry in an unix file?

Hi, I've a data file having entries like this- $ cat BDWL.out 19571 349484 18963 349568 20180 351389 20372 350253 Now I want to add each entry and produce the final sum =1479780 as output. How can I do that using unix shell scripting?? using loop or sed/awk ?? Thanks, Naresh (5 Replies)
Discussion started by: NARESH1302
5 Replies

7. Shell Programming and Scripting

Script to detect dynamic ip change and update to config file

Hi All, I am newbie here and request your assistance. I have a service running on public ip, but since I have a dynamic IP it keeps on changing and every time I need to manually get the new ip and add to the config file and restart the service. This has become bit time consuming. Hence, I... (4 Replies)
Discussion started by: Shaan_Shaan
4 Replies

8. Shell Programming and Scripting

Shell script to find if any new entry in directory

I require a shell script to find if any new entry of dump files present in a particular directory and to send an email if any new entry exists.I had a crontab to run the script for every 5 min. Below are the file names.dump.20150327.152407.12058630.0002.phd.gz... (9 Replies)
Discussion started by: bhas85
9 Replies

9. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

10. Shell Programming and Scripting

awk script to detect specific string in a log file and count it

Hello, can someone guide me on this? I don't know what is the best approach, (awk script, shell script) I am using RedHat Linux version 6.5. There is a third party application deployed on that server. This app by default generates 5 log files and each file is 20MB. These log rollover... (5 Replies)
Discussion started by: ktisbest
5 Replies
FANOTIFY_INIT(2)					     Linux Programmer's Manual						  FANOTIFY_INIT(2)

NAME
fanotify_init - create and initialize fanotify group SYNOPSIS
#include <fcntl.h> #include <sys/fanotify.h> int fanotify_init(unsigned int flags, unsigned int event_f_flags); DESCRIPTION
For an overview of the fanotify API, see fanotify(7). fanotify_init() initializes a new fanotify group and returns a file descriptor for the event queue associated with the group. The file descriptor is used in calls to fanotify_mark(2) to specify the files, directories, and mounts for which fanotify events shall be created. These events are received by reading from the file descriptor. Some events are only informative, indicating that a file has been accessed. Other events can be used to determine whether another application is permitted to access a file or directory. Permission to access filesystem objects is granted by writing to the file descriptor. Multiple programs may be using the fanotify interface at the same time to monitor the same files. In the current implementation, the number of fanotify groups per user is limited to 128. This limit cannot be overridden. Calling fanotify_init() requires the CAP_SYS_ADMIN capability. This constraint might be relaxed in future versions of the API. Therefore, certain additional capability checks have been implemented as indicated below. The flags argument contains a multi-bit field defining the notification class of the listening application and further single bit fields specifying the behavior of the file descriptor. If multiple listeners for permission events exist, the notification class is used to establish the sequence in which the listeners receive the events. Only one of the following notification classes may be specified in flags: FAN_CLASS_PRE_CONTENT This value allows the receipt of events notifying that a file has been accessed and events for permission decisions if a file may be accessed. It is intended for event listeners that need to access files before they contain their final data. This notification class might be used by hierarchical storage managers, for example. FAN_CLASS_CONTENT This value allows the receipt of events notifying that a file has been accessed and events for permission decisions if a file may be accessed. It is intended for event listeners that need to access files when they already contain their final content. This notifi- cation class might be used by malware detection programs, for example. FAN_CLASS_NOTIF This is the default value. It does not need to be specified. This value only allows the receipt of events notifying that a file has been accessed. Permission decisions before the file is accessed are not possible. Listeners with different notification classes will receive events in the order FAN_CLASS_PRE_CONTENT, FAN_CLASS_CONTENT, FAN_CLASS_NOTIF. The order of notification for listeners in the same notification class is undefined. The following bits can additionally be set in flags: FAN_CLOEXEC Set the close-on-exec flag (FD_CLOEXEC) on the new file descriptor. See the description of the O_CLOEXEC flag in open(2). FAN_NONBLOCK Enable the nonblocking flag (O_NONBLOCK) for the file descriptor. Reading from the file descriptor will not block. Instead, if no data is available, read(2) fails with the error EAGAIN. FAN_UNLIMITED_QUEUE Remove the limit of 16384 events for the event queue. Use of this flag requires the CAP_SYS_ADMIN capability. FAN_UNLIMITED_MARKS Remove the limit of 8192 marks. Use of this flag requires the CAP_SYS_ADMIN capability. The event_f_flags argument defines the file status flags that will be set on the open file descriptions that are created for fanotify events. For details of these flags, see the description of the flags values in open(2). event_f_flags includes a multi-bit field for the access mode. This field can take the following values: O_RDONLY This value allows only read access. O_WRONLY This value allows only write access. O_RDWR This value allows read and write access. Additional bits can be set in event_f_flags. The most useful values are: O_LARGEFILE Enable support for files exceeding 2 GB. Failing to set this flag will result in an EOVERFLOW error when trying to open a large file which is monitored by an fanotify group on a 32-bit system. O_CLOEXEC (since Linux 3.18) Enable the close-on-exec flag for the file descriptor. See the description of the O_CLOEXEC flag in open(2) for reasons why this may be useful. The following are also allowable: O_APPEND, O_DSYNC, O_NOATIME, O_NONBLOCK, and O_SYNC. Specifying any other flag in event_f_flags yields the error EINVAL (but see BUGS). RETURN VALUE
On success, fanotify_init() returns a new file descriptor. On error, -1 is returned, and errno is set to indicate the error. ERRORS
EINVAL An invalid value was passed in flags or event_f_flags. FAN_ALL_INIT_FLAGS defines all allowable bits for flags. EMFILE The number of fanotify groups for this user exceeds 128. EMFILE The per-process limit on the number of open file descriptors has been reached. ENOMEM The allocation of memory for the notification group failed. ENOSYS This kernel does not implement fanotify_init(). The fanotify API is available only if the kernel was configured with CONFIG_FAN- OTIFY. EPERM The operation is not permitted because the caller lacks the CAP_SYS_ADMIN capability. VERSIONS
fanotify_init() was introduced in version 2.6.36 of the Linux kernel and enabled in version 2.6.37. CONFORMING TO
This system call is Linux-specific. BUGS
The following bug was present in Linux kernels before version 3.18: * The O_CLOEXEC is ignored when passed in event_f_flags. The following bug was present in Linux kernels before version 3.14: * The event_f_flags argument is not checked for invalid flags. Flags that are intended only for internal use, such as FMODE_EXEC, can be set, and will consequently be set for the file descriptors returned when reading from the fanotify file descriptor. SEE ALSO
fanotify_mark(2), fanotify(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 FANOTIFY_INIT(2)
All times are GMT -4. The time now is 09:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy