incrontab $@ giving subdirectory and not watched directory

Ichchhit Baranwal :

/tmp/target_dir IN_MODIFY,IN_CREATE,IN_MOVED_TO /tmp/script.sh $@

contents of script.sh

echo $1 > /tmp/script.log

on executing

cp -r some_dir /tmp/target_dir

contents of /tmp/script.log

/tmp/target_dir

on executing

cp some_file /tmp/target_dir/some_dir 

contents of /tmp/script.log

/tmp/target_dir/some_dir

here instead of watched directory directory on which work is done is echoed. As far as i understand from here $@ is used to display watched system path.

Armali :

As far as i understand from here $@ is used to display watched system path.

Stated there is: When monitoring a directory, the events marked with an asterisk (*) above can occur for files in the directory, in which case the name field in the returned event data identifies the name of the file within the directory.

instead of watched directory directory on which work is done is echoed.

The directory on which work is done is exactly the file within the directory as documented. (Copying some_file into /tmp/target_dir/some_dir has modified /tmp/target_dir/some_dir.)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=24370&siteId=1