-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/integrate on off boarding scripts #14
Conversation
// Set the response code based on script_result | ||
int response_code = (script_result == 0) ? MHD_HTTP_OK : MHD_HTTP_INTERNAL_SERVER_ERROR; | ||
ret = MHD_queue_response(connection, response_code, response); | ||
const char *output_file = "/opt/demo-server/html/log_file.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the constant string as a #define
in a config.h
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem 👍 . Sorry for leaving paths like that.
ret = MHD_queue_response(connection, response_code, response); | ||
const char *output_file = "/opt/demo-server/html/log_file.txt"; | ||
// Execute the onboarding script | ||
int script_result = execute_script_async("/opt/demo-server/bash-scripts/onboard.sh", output_file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same with the string "/opt...". Needs to be defined as a constant in config.h
@@ -109,7 +109,15 @@ static enum MHD_Result answer_to_connection(void *cls, struct MHD_Connection *co | |||
|
|||
if (strcmp(url, "/onboard") == 0) { | |||
fprintf(stdout, "Received onboard request\n"); | |||
execute_script("/opt/demo-server/bash-scripts/onboard.sh"); | |||
int script_result = execute_script("/opt/demo-server/bash-scripts/onboard.sh"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this needs to be in the config.h
Ideally the "opt" paths need be created by the debian installer in the process of installing the package. |
Added "opt" path creation to postinst file. |
I have opened the http port 8082 on the nqm-perfect-pi so you can test the web app. You can click this https://openport.io/l/49503/fuiOyLGf0OX79Z7n to activate the connection and then this http://openport.io:49503/ to access the app. Please do let me know if anything is wrong or needs changing. For displaying the logs I have used a simple file, so may not be exactly real time logs. I think is quite a complex task to achieve real-time displaying using libmicrohttpd. |
Integrated onboarding script and fixed some minor issues. - not tested - do not merge please