I’m a beginner with freePBX.
But I design my own server based on a ATOM computer and a 12V UPS system.
What I want to do is this, first wrote some code that talks with the serial port and update some MySQL table that then let me build a php active page that show this information.
So for now I need to know two things:
Can I write some script/python that the OS can run and recovery data from the serial port ?
How I can update a MySQL table ?
How I can access this table from the WEB and recovery the MySQL table and print it in HTML?
A point to start will be great, I will read about it to clarify these ideas bur almost to start I need the basements
A beginner in FreePBX or a beginner in all things linx?, If you have a modicum of linux skills then a possibl;e good “basement” might be :-
I make some assumptions, your serial port is asynchronous (both in physical signaling and data stream) in other words what comes into the serial port needs to be buffered so you don’t lose data. This you can do with something like:-
make sure you set baudrate bytesize stopbits etc. to suit.
To update a mysql table the mysql syntax is:-
UPDATE table_reference SET col_name1=expr1, col_name2=expr2 […] WHERE where_condition;
Use bash or php or perl or whatever wrapper to do that. The data you want to update will be in /yourfile it is up to you to ensure all updates are applied before you discard that data.
That was your two questions, a free bonus to 3) is, php is well designed to do exactly that for you.
Good luck. I think you have a little work to do yet
Since you mentioned your 12v UPS, I’m assuming you wish to communicate with it… you can take a look at the SysAdmin Pro module that includes support for UPS integration. The module is $25.
UPS Management - UPS management can be integrated directly into FreePBX. This can be used to properly shutdown the PBX in case of power loss. This module can also alert you to power related issues.
I suggest you spend quite some time learning the basics of the OS and “scripting” by googleing for “bash tutorial”. It will then all slowly become clear.
Basically any text file can be made executable, the first line will let the OS what interpreter to use, for example