I am new to scripting, I made a script that reads 2 files and execute commands and as output a log file.
I want this script to run like a daemon and wait for changes in these 2 files to execute these commands again on theses files.
I am aware of using some inotify, but I don't know exactly how to use it and where to place the loop so the script will work as I want it too, that is:
- user executes the script for the first time
- this script reads these files and make the output log
- the script "sleeps" (daemonized) until these 2 log files change (some lines added to them)
- execute the same script again on these files
- sleep again and wait for changes in these 2 files