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 ?
./filewatcher_maxdb76.sh
./filewatcher_maxdb76.sh: line 5: inotifywait: command not found
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
rbatte1
November 29, 2017, 10:38am
2
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:-
uname -a
ps
echo $PATH
find / -iname inotifywait
Thanks, in advance,
Robin
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
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
[root@AEU12AAA001CAB ~]# find / -iname inotifywait
[root@AEU12AAA001CAB ~]#
Below out put is from server where inotifywait is working
[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
RudiC
November 29, 2017, 11:53am
4
So - what would be your conclusion?