I wrote a basic inotifywait shell script on my CentOS 5.6 x86_64 test server that syncs any deleted files in a directory.
/usr/bin/script
#!/bin/sh
inotifywait -m -e delete /home/user/test | while read file; do
# log event here
done
The script alone works fine. However, the terminal prompt is not available.
Is there a way to pipe the response to a specific location what will still allow the script to run, so the terminal is not trapped?
If you don't want to use the output at all, how about
nohup ./script & disown
This will redirect or close all binds to the terminal when it launches the script, put it into the background, and prevent the shell from waiting for it.
disown is not available on all shells, but if you don't have it, you don't need it either.
If you want to make it a daemon, see man start-stop-daemon.