Good morning,
my idea is to upgrade some STM32 board monitored with Mango,
about this I've a flag named "upgrade" , when upgrade=1 then I want to disable datasources, update the firmware with a Python script then enable the datasources and send a reboot signal.
My idea was about using a scripting datasource, but it is not possible to specify less than 1 minute with cron.
Looking instead at an alarm associated to "upgrade" it seems that it is only possible to run OS processes and so it is not possible to enable and disable the datasources as I need.
Any idea about how to fire a Mango script using a point event handler
or
how to set a scripting datasource execution every five seconds.
thanks,
Antonio
iif (upgrade.value === 1) {
print( "Update required!" );
print( "Start datasource shutdown " );
RuntimeManager.disableDataSource('FML01-main');
RuntimeManager.disableDataSource('FML01-conf');
print( "End datasource shutdown" );
print( "START target Update Script" );
var response = com.serotonin.m2m2.rt.maint.work.ProcessWorkItem.executeProcessCommand("/home/solergy/./tracker_upgrade_IP.sh S07E-MCU-3AX.bin upload 172.16.9.12", 300);
print( response.key );
print( "END target Update Script" );
print( "Start datasource power-on " );
RuntimeManager.enableDataSource('FML01-main');
RuntimeManager.enableDataSource('FML01-conf');
print( "End datasource power-on" );
java.lang.Thread.sleep(90000);
print("Start board reset");
manualAct.set(8);
}else{
print( "Update not required." );
}