B4J Question Auto empty disk cache under Linux

Alessandra Pellegri

Active Member
Licensed User
I have a code that is running in an embedded device. When I save settings and I turn off the device, my settings are lost because they still are in disk cache.
To solve this I created this function:
Sub syncExecute
   Dim shl As Shell
   shl.Initialize("syncEvent", "sync", Null)
   shl.WorkingDirectory = "/home/pi"
   shl.Run(10000) 'set a timeout of 10 seconds
End Sub
I would like to know if there is some specific function embedded in B4j to avoid calling external "sync".

Thank you very much,


Active Member
Licensed User
I don't think there is an alternative, as this matter is in the hands of the OS, not B4J. But the main question is, why are those settings are still in cache? How do you turn your device off? If you do a proper shutdown, this shouldn't be necesary.