# Error while using inotifiywait

**URL:** <https://community.unix.com/t/error-while-using-inotifiywait/369552>\
**Category:** Shell Programming and Scripting\
**Created:** [November 29, 2017, 10:23am UTC](https://community.unix.com/t/error-while-using-inotifiywait/369552 "2017-11-29T10:23:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocking77](https://community.unix.com/letter_avatar/rocking77/32/6_449c533f586939b6e5f246632a46421f.png) [@rocking77](https://community.unix.com/u/rocking77)\
**Post date:** [November 29, 2017, 10:23am UTC](https://community.unix.com/t/error-while-using-inotifiywait/369552/1 "2017-11-29T10:23:59Z")

</div>

I Ran below shell script to place some logs from local to Amazon storage S3 .Where the highlighted line giving error ..Can some one suggest why is it failing ?

```nohighlight
 ./filewatcher_maxdb76.sh
./filewatcher_maxdb76.sh: line 5: inotifywait: command not found

```

```nohighlight
arch_transact_dir=/opt/ibm/db2/archive_logs/
#arch_dump_dir=/db2_archive_logs/dumps
#active_transact_dir=/db2_active_logs/transaction_logs
inotifywait -r $arch_transact_dir -e close_write | while read path action file; do
      if [[${file: -4} != ".swp"]] && [[${file: -5} != ".swpx"]] && [[${file: -4} != ".swx"]]; then
         ts=$(date +"%d.%m.%C%y %H:%M:%S")
         aws s3 --acl=bucket-owner-full-control cp $path/$file s3://cleveltransfer/upload/environment_backups/PB2/Maximo/transactions/$file >> /tmp/filewatcher.log 2>&1
      fi
   sleep 600
   done
exit 0

```

---

<div class="post-metadata">

**Author:** ![rbatte1](https://community.unix.com/letter_avatar/rbatte1/32/6_449c533f586939b6e5f246632a46421f.png) [@rbatte1](https://community.unix.com/u/rbatte1)\
**Post date:** [November 29, 2017, 10:38am UTC](https://community.unix.com/t/error-while-using-inotifiywait/369552/2 "2017-11-29T10:38:33Z")

</div>

Either inotifywait is not installed or it's not in your PATH.

You don't tell us your OS version or shell, so please can you show us (wrapped in CODE tags) the output for:-

```nohighlight
uname -a
ps
echo $PATH
find / -iname inotifywait

```

Thanks, in advance,  
Robin

---

<div class="post-metadata">

**Author:** ![rocking77](https://community.unix.com/letter_avatar/rocking77/32/6_449c533f586939b6e5f246632a46421f.png) [@rocking77](https://community.unix.com/u/rocking77)\
**Post date:** [November 29, 2017, 10:51am UTC](https://community.unix.com/t/error-while-using-inotifiywait/369552/3 "2017-11-29T10:51:02Z")

</div>

```nohighlight
echo $PATH
:/opt/ibm/db2/inst1/sqllib/bin:/opt/ibm/db2/inst1/sqllib/adm:/opt/ibm/db2/inst1/sqllib/misc:/opt/ibm/db2/inst1/sqllib/db2tss/bin:/opt/ibm/db2/inst1/.local/bin:/opt/ibm/db2/inst1/bin

```

```nohighlight
 ps
  PID TTY TIME CMD
18600 pts/4 00:00:00 bash
18764 pts/4 00:00:00 db2bp
19583 pts/4 00:00:00 ps

```

Below output from server where inotifywait is not working

```nohighlight
[root@AEU12AAA001CAB ~]# find / -iname inotifywait
[root@AEU12AAA001CAB ~]# 

```

Below out put is from server where inotifywait is working

```nohighlight
[root@AEU12AAA002CBD ~]# find / -iname inotifywait
/usr/local/bin/inotifywait
/opt/ibm/db2/inst1/inotify-tools-3.14/src/inotifywait
/opt/ibm/db2/inst1/inotify-tools-3.14/src/.libs/inotifywait

```

---

<div class="post-metadata">

**Author:** ![RudiC](https://community.unix.com/letter_avatar/rudic/32/6_449c533f586939b6e5f246632a46421f.png) [@RudiC](https://community.unix.com/u/RudiC)\
**Post date:** [November 29, 2017, 11:53am UTC](https://community.unix.com/t/error-while-using-inotifiywait/369552/4 "2017-11-29T11:53:11Z")

</div>

So - what would be your conclusion?
