java等待赛门铁克终点DoScan。exe完成文件扫描
我正在开发一个使用文件上传的应用程序。我的客户端在Windows Server上使用Symantec端点保护
所以,我使用一个示例代码来检查服务器上是否上传了一个文件
我正在使用命令行呼叫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
但是"int exitVal = process.waitFor();"
在SEP将日志写入文件之前返回
因此,是SEP"DoScan.exe"
内部调用线程来开始扫描文件
如果是,请给我一个替代方案
任何帮助都将不胜感激
# 1 楼答案
我创造了一个适合我的解决方案
在这里,在Symantec AV写入之前
int exitVal = process.waitFor();
返回的结果。日志文件所以,我编写了一个循环,它根据日志文件的最后修改日期不断进行检查
一旦日志文件被修改,我就会读取结果