I'm trying to output a system netstat -an -p TCP $interval > $log
for a sleep of $seconds, and then quit/kill the netstat command but am having trouble getting it to work correctly.
If I use start netstat...
, my sleep and kill commands work, but it does not write to the log.
If I only use netstat...
, then it writes to the logs, but will not move on to the sleep and kill commands.
Any ideas on how to solve this??
$netstat_cmd = "netstat -an -p TCP $interval >$netstatlog;
$stop_netstat_cmd = "c:\utilities\pskill NETSTAT.exe";
system($netstat_cmd);
sleep $seconds;
system "$stop_netstat_cmd";
Thanks!