Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Calls Problem

Status
Not open for further replies.
Joined
Jun 19, 2006
Messages
2
Location
US
I have recently began supporting a Windows based perl application, PERL 5.8.7, am new to perl and have encountered a problem in relation to system calls from within some perl scripts. Basically the OS operation with the system call does not get executed. Please see the following code sample.

# Repeatedly ping box until successful or max pings reached.
while ($v_Pings < $v_MaxPings ) {
system("ping $v_Box 1>>$f_PingOut 2>&1") ;
( tfa_llgrep_b_pl ("$f_PingOut<=$c_GoodPing") ) && last;
( tfa_llgrep_b_pl ("$f_PingOut<=$c_GoodPing") ) && last;
$v_Pings++;}

Subsequent statements do get executed, but the system call never seems to run/fails to run.

Any guidance on correcting the system call or alternatives for executing the command enclosed within the system call would be appreciated.
 
Since you are on Windows use full path to ping
Code:
system("C:\WINNT\system32\ping $v_Box 1>>$f_PingOut 2>&1") ;

M. Brooks
 
Thanks for this - I will try it out. Another related question on system calls.

What is the correct way to invoke a number of perl scripts to execute without waiting for output/return from within a single controlling script? again, this is for a Windows environment.
 
CreateProcess

Win32::Process

You have the option of waiting or whatever. Also setting priority etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top