dnotify

Langue: en

Version: March 11, 2002 (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)

NAME

dnotify - Execute a command when the contents of a directory change

SYNOPSIS

dnotify [OPTION]... DIRECTORY... [-e COMMAND...]

DESCRIPTION

This manual page document describes the dnotify command.

The dnotify program executes COMMAND every time the contents of any of the specified directories change. If a command is not specified, `echo {}' is assumed.

What is considered a change is determined by the `--access', `--modify', `--create', `--delete', `--rename' and `--attrib' options (see below). These options may be combined. If none of them are specified, create and delete are assumed.

The string `{}' in the command specification is replaced by the name of the directory that was updated.

OPTIONS

This program follow the usual GNU command line syntax, with long options starting with two dashes (`-').
-A, --access
Trigger the command when a file in one of the directories was accessed (read).
-M, --modify
Trigger the command when a file in one of the directories was modified (i.e. written or truncated).
-C, --create
Trigger the command when a file was created in a directory.
-D, --delete
Trigger the command when a file was removed from a directory.
-R, --rename
Trigger the command when a file in one of the directories was renamed.
-B, --attrib
Trigger the command when a file in one of the directories had its attributes changed (as a result of chmod or chown).
-a, --all
Trigger the command when any of the events above occurs. That is, this is a shorthand for '-AMCDRO'.
-e, --execute=COMMAND...
This option specifies the command to execute. All arguments (including possible options) following this option are treated as arguments to the command.

The string `{}' in the command specification is replaced by the name of the directory that was updated (just like find(1)).

-f, --file=FILE
The option specifies a file containing directory names to monitor, as if they had been specified on the command line. There must be one directory name per line in the file.

This option can be used multiple times.

-p, --processes=COUNT
This option specifies the maximum number of commands to be run at the same time. It is possible to allow an unlimited number of commands to be run at the same time by specifying COUNT as 0 or -1.

The default value is 1.

-q, --queue=DEPTH
This option specifies the maximum number of commands to queue up while there are other commands already executing. This is usually used in conjunction with the --processes option. An unlimited depth of the queue can be achieved by specifying DEPTH as -1.

The default value is -1.

-t, --times=COUNT
Exit dnotify once the command has been run (and finished running) COUNT times.
-o, --once
Exit dnotify when the specified command has been run once. This is equivalent to `--times 1'.
-r, --recursive
Traverse the specified directories and monitor all subdirectories (at any depth) as well.

dnotify will only scan directories once to find out subdirectories to monitor when recursive mode is enabled. If you want to monitor any subdirectory created, you will have to stop and restart dnotify every time a create or delete event occurs.

-b, --background
Run dnotify in the background - detach from terminal. Prior to executing any commands, dnotify will change the current directory to the root directory (`/'). Relative path names of directories to monitor will be made absolute automaticly, but make sure the command you specify does not rely on the current directory being unchanged.
-s, --silent, --quiet
Do not print warnings when the executed commands exits with a non-zero return value.
--help
Show summary of options.
--version
Output version information and exit.

EXAMPLES

Print 'change' to the terminal every time a file (or part of file) in /etc is read.
       dnotify -A /etc -e echo change

Execute the script 'informdelete' every time a file in /var/mail is created or deleted.
       dnotify -CD /var/mail -e informdelete

AUTHOR

dnotify was written by Oskar Liljeblad <oskar@osk.mine.nu>.