firstbishop
March 1st, 2005, 09:21 AM
Our switchboard outputs phone call data to the serial port of a dedicated Ubuntu box. I am running minicom on that machine and it picks up the incoming data very nicely and captures to a file, which is periodically parsed by a PHP script and the resulting information written to a MySQL database.
My problem is that using the "minicom -C capturefilename" option means that the file is only updated when I exit from minicom. I haven't been able to find a way to update on an ongoing basis as call data is received from the switchboard.
I have tried running a bash script from a cron job which shuts down minicom and restarts it at 2 in the morning. Although the script runs fine when I test it, for some reason when cron executes the script, I get a whole lot of strange stuff appearing in both the capture file and the email detailing what the cron job has done (For example, the minicom window itself is captured, along with a host of what look like control characters or something).
Is there any reason why a script would behave so differently when executed by cron, as opposed to execution from the command line?
Another alternative I have tried is to simply type cat -v /dev/ttyS1 > phonedata.
That would seem to me to be the most elegant solution, but, although the file is opened, no data is written to it by that command.
Am I missing something obvious here?
I'd really appreciate any pointers. Thanks
Mike
My problem is that using the "minicom -C capturefilename" option means that the file is only updated when I exit from minicom. I haven't been able to find a way to update on an ongoing basis as call data is received from the switchboard.
I have tried running a bash script from a cron job which shuts down minicom and restarts it at 2 in the morning. Although the script runs fine when I test it, for some reason when cron executes the script, I get a whole lot of strange stuff appearing in both the capture file and the email detailing what the cron job has done (For example, the minicom window itself is captured, along with a host of what look like control characters or something).
Is there any reason why a script would behave so differently when executed by cron, as opposed to execution from the command line?
Another alternative I have tried is to simply type cat -v /dev/ttyS1 > phonedata.
That would seem to me to be the most elegant solution, but, although the file is opened, no data is written to it by that command.
Am I missing something obvious here?
I'd really appreciate any pointers. Thanks
Mike