I have a shell script:
#!/bin/bash
while true
do
for name in /home/imp/imp/msgs/*.PK1; do
mv "$name" "${name%.PK1}.BRD" 2>/dev/null >/dev/null
done
for name in /home/imp/imp/msgs/*.PK2; do
mv "$name" "${name%.PK2}.MIX" 2>/dev/null >/dev/null
done
sleep 1; done
I have various message files which contain messages that are posted on my BBS. This script updates and renames temporary files which are then, in turn converted to non temporary files. The script works fine, the problem is that I have to run the main BBS program with a switch (-P) to "pack" the message bases, before the script will actually work. I hope i'm being verbose enough with this. I think people who are familiar with how BBSes work will "get" this message. Others may not. So, let me explain further: I "post" (write) a message on the BBS, then the BBS creates two temporary files: BOARDNAME.PK1 and BOARDNAME.PK2, which in turn are converted into BOARDNAME.MIX (BOARDNAME being the "area" that the message is posted to) and BOARDNAME.BRD files when the script is executed. What I need it to do, is "watch and convert" the files when the BBS program is called with that "-P" switch. Is this possible? Let me know if you need more information on this topic.
Thank you.
inotify
to detect changes rather then continually polling for them. – HostFission Aug 24 '17 at 10:20inotify
? – ignatius Aug 24 '17 at 22:36