On Update Toc with LibreOffice Command, there is a working solution (Many thanks to ChanMo!!!)
Create a macro module in libreoffice or add the following code in an existing module (eg. “Standard.Module1”).
REM  *****  BASIC  *****
 Option Explicit
 Sub UpdateIndexes(path As String)
     '''Update indexes, such as for the table of contents''' 
     Dim doc As Object
     Dim args()
     doc = StarDesktop.loadComponentFromUrl(convertToUrl(path), "_default", 0, args())
     Dim i As Integer
     With doc ' Only process Writer documents
	 If .supportsService("com.sun.star.text.GenericTextDocument") Then
	     For i = 0 To .getDocumentIndexes().count - 1
		 .getDocumentIndexes().getByIndex(i).update()
	     Next i
	 End If
     End With ' ThisComponent
     doc.store()
     doc.close(True)
 End Sub ' UpdateIndexes  
Save the module and run the macro on your file with this command line:
soffice --headless "macro:///Standard.Module1.UpdateIndexes(/path/to/file.odt)"
Done!
Note: Here, we suppose that the macro is in the module “Standard/Module1”. Change the path if necessary.