Sub AppStart
'Assumes B4J-Bridge called with full path from sudo Crontab, so the relevant tempjars folder is in hidden /root folder
If GetSystemProperty("b4j.ide", "false") Then
If File.Exists("/root/tempjars","AsyncInput1") Then
Log(Subs.TimedLog("B4J Bridge Running. Copying AsyncInput1 to AppName.jar..."))
Dim shl_CopyProgram As Shell
shl_CopyProgram.Initialize("shl_CopyProgram","sudo",Array As String("cp","/root/tempjars/AsyncInput1","/home/pi/AppFolder/AppName.jar"))
shl_CopyProgram.Run(-1)
Else If File.Exists("/root/tempjars","AsyncInput2") Then
Log(Subs.TimedLog("B4J Bridge Running. Copying AsyncInput2 to AppName.jar..."))
Dim shl_CopyProgram As Shell
shl_CopyProgram.Initialize("shl_CopyProgram","sudo",Array As String("cp","/root/tempjars/AsyncInput2","/home/pi/AppFolder/AppName.jar"))
shl_CopyProgram.Run(-1)
Else
Log(Subs.TimedLog("B4J Bridge Running but missing file '/home/pi/tempjars/AsyncInput1 or 2"))
End If
Else
Log(Subs.TimedLog("B4J Bridge Not Running."))
End If