2011-03-14 69 views
2

我正在開發使用文件上傳的應用程序。我的客戶端在Windows Server上使用Symantec End Point Protection。等到Symantec Endpoint DoScan.exe完成文件掃描

所以,我使用示例代碼來檢查文件是否上傳到服務器上。

我正在使用命令行調用SEP。

示例代碼:

   String[] commands = new String[6]; 
       commands[0] = "cmd"; 
       commands[1] = "/c"; 

       commands[2] = "C:\\Program Files\\Symantec\\Symantec Endpoint Protection\\DoScan.exe"; 
       commands[3] = "/cmdlinescan"; 
       commands[4] = "/ScanFile"; 
       commands[5] = fileName; 

      Process process = Runtime.getRuntime().exec(commands); 

      int exitVal = process.waitFor(); 

我也跨過來了,SEP生成工作日誌在每次掃描的文件。

scanResult = "C:\\Documents and Settings\\All Users\\Application Data\\"Symantec\\Symantec Endpoint Protection\\Logs\\"; 

所以,這裏我想掃描文件。

我已經放置檢查,開始讀取文件的位置。一旦它從處理返回0

但是在SEP將日誌寫入文件之前得到返回"int exitVal = process.waitFor();"

那麼,SEP "DoScan.exe"是否會以線性方式調用線程來開始掃描文件。

如果是,請給我一個替代方案。

任何幫助,將不勝感激

+0

你知道嗎? – Sridhar 2016-09-15 10:04:46

+0

它的5歲的職位。這是演示。 – 2016-10-03 13:24:18

回答

0

我已經創建了一個適合我的解決方案。

這裏,在Symantec AV寫入之前得到的int exitVal = process.waitFor();結果返回.log文件。

所以,我寫了一個循環,它根據日誌文件的最後修改日期繼續檢查。

有一次,日誌文件被修改,我讀取結果。

+0

process.waitFor()返回給我一個整數1任何想法是什麼意思? – Sridhar 2016-09-15 09:21:50