AEP Custom App questions?
Home › Forums › Conduit: AEP Model › AEP Custom App questions?
Tagged: Conduit Aep, Custom App
- This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by Ajay K.
-
AuthorPosts
-
April 28, 2017 at 10:44 am #18827Ajay KParticipant
Just wanted some clarifications around installing and running custom applications on the new AEP firmware.
1) With the new firmware, the custom app can be run from within the Conduit flash as opposed to setting up the custom app on the external mcard correct?
2) Is it possible to order when the custom app runs when the conduit boots up, for example, can it be run before the node-red application reboots or can it be parallelized to start with the lora wan server and/or mqtt broker?
3) If by any chance the Custom application exits because of an exception, what is the best way to restart it. Basically detect that it has exited and automatically restart it?
4) This is a nodejs based custom app, can the console.log statements being executed within the custom app be re-directed to a log file under /var/logs/app/<app-name>/<app-name>.log?
Thanks,
AjayMay 1, 2017 at 8:14 am #18836Jeff HatchKeymasterAjay,
1) With the new firmware, the custom app can be run from within the Conduit flash as opposed to setting up the custom app on the external mcard correct?
Yes, that is correct, you will not need an SD card on AEP-1.4.1
2) Is it possible to order when the custom app runs when the conduit boots up, for example, can it be run before the node-red application reboots or can it be parallelized to start with the lora wan server and/or mqtt broker?
The custom app will be started just before the Node-RED app. Are you looking to restart the custom application in tandem with the Node-RED application? The LoRa network server starts before the custom application, but after mosquitto. The following is the contents of rc5.d:
admin@mtcdt:/etc/rc5.d# ls S01networking S78ddns S02dbus-1 S80dnsmasq S15mountnfs.sh S80lora-network-server S20hostapd S81ppp S20hwclock.sh S81time S20ntpd S85ser-cli S20syslog S85smsd S30api S85wan-manager S31local-time S90crond S50usb-gadget S92led-cd-ss S60lighttpd S95annex-client S61syslog-configure S95auto-reboot S65remove-rs9113 S95call_home S70mosquitto S95customapp S71backoff-timers S95gps S71database-init S95led-status_heartbeat_trigger S71wireless-conf S95node-red S72lanup S95remove_upgrade_occurred S72post-upgrade S95reset-handler S73bluetooth S95stunnel S73wifi S95watchdogd S75firewall S99rmnologin.sh S75routing_table_setup S99stop-bootlogd S76sshd
3) If by any chance the Custom application exits because of an exception, what is the best way to restart it. Basically detect that it has exited and automatically restart it?
There are several ways to accomplish restart on a failure/fault/crash. One of the simplest it to write a script that is started by the applications Start script that does something like the following:
MYAPP="app_executable -arg1 -arg2 ..." until $MYAPP; do echo "myapp exited with status $? -restarting..." >&2 sleep 1 done
This will run the app executable, and when it exits will restart it. The only problem here is shutting down the app. For that you would need a signal handler to stop the executable app.
4) This is a nodejs based custom app, can the console.log statements being executed within the custom app be re-directed to a log file under /var/logs/app/
/ .log? You can do the same as what is done with Node-RED on the Conduit – pipe the output of the process to a file:
myapp -arg1 -arg1 >& /var/log/app/
/ .log Hope that helps,
Jeff
May 1, 2017 at 9:50 am #18840Ajay KParticipantHi Jeff,
Thanks for taking the time to respond and writing in such detail. In terms of restarting an application, do other apps like lora-wan server, and node-red, do they implement this at their end. I am just wondering if its worth spending time on this?
Also is there a way to invoke this script that you mentioned above from node-red flow to say re-start a custom app, if it went down by any chance?
Thanks,
Ajay -
AuthorPosts
- You must be logged in to reply to this topic.