0

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.

3
  • 1
    You might be better seved using inotify to detect changes rather then continually polling for them. Commented Aug 24, 2017 at 10:20
  • Possibly related: Script to monitor folder for new files? Commented Aug 24, 2017 at 10:41
  • Ok. Thanks, but how would I use inotify? Commented Aug 24, 2017 at 22:36

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.