I want to be able to set the time on a remote Pi using a web interface.
The remote Pi has a web interface with a number of functions, and I've built a form which allows the user to set year, month, day, hour and minute. This is processed by come CGI written in C++ which lives in cgi-bin. This uses the system( const char* command ) to invoke the date command as you would at the command line.
A typical command would be
which works fine at the command line, but returns 256 in my C++ code and fails to update the date.
I assume this is some kind of permissions problem, so two questions:
1) Is this the beat way to set the date from a CGI program written in C++ ?
2) Is it possible to use system() from a CGI program ?
3) What changes do I need to do to enable the system() command to work ?
I also want to be able to remount a partition under the control of this CGI to be able to make it temporarily writable. Again I was thinking of using the system() approach. Will I run into the same problems, and is there a better way ?
Many thanks, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).