Hello, A few days ago i was asking about pids and learn something.
I am monitoring closely some interfaces and expect to move this into ifstated as a configuration. I am trying to keep it simple and i do a proto in perl. There is multiple default routes, and i want to test if the underlying network is ok or not. The following small function is checking the netwokr by icmping a peer (the peer depends of the underlying network i want to test). The ping refuse to bind $_[0]->{ 'fixed-address' } only in script perl when no -d ! 35 sub lsystem { 36 say (Dumper(@_)); 37 return system(@_); 38 } 102 sub is_ifup { 103 my @cmd = ('/sbin/ping', '-q', '-c', '2', '-w', '1'); 104 push @cmd, '-I', $_[0]->{ 'fixed-address' }, $_[0]->{ peer_test }; 105 return not lsystem( @cmd ); 106 } perl exectution : $VAR1 = '/usr/bin/pkill'; $VAR2 = '-HUP'; $VAR3 = '-f'; $VAR4 = '^dhclient: trunk0'; $VAR1 = '/sbin/ping'; $VAR2 = '-q'; $VAR3 = '-c'; $VAR4 = '2'; $VAR5 = '-w'; $VAR6 = '1'; $VAR7 = '-I'; $VAR8 = '10.0.0.126'; $VAR9 = '10.0.0.171'; ping: bind: Can't assign requested address #but just after same command is ok ... [0] ulis-v12-GW 34# /sbin/ping -q -c 2 -w 1 -I 10.0.0.126 10.0.0.171 PING 10.0.0.171 (10.0.0.171): 56 data bytes --- 10.0.0.171 ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 29.048/30.200/31.352/1.152 ms [0] ulis-v12-GW 35# and if i relaunch perl it is nok. Something i found strange, once i launch the script with -d , it does the job (and add a route for this network) and then no more problem..... I do not know where to look , perl doc or ping ? -- --------------------------------------------------------------------------------------------------------------------- () ascii ribbon campaign - against html e-mail /\