Script for ping on Background Process

Hi All,
I'm doing one script on Juniper router where you have one FreeBSD Shell:
Is pinging from time to time one ethernet port of othere router and in case of fail is blocking one port entering in CLI and doing some command:
If I run this script all is working perfectly, but if I run in Backgroung using "&" is blocked on ping (ping -c1 $RemoteIPAddress) . Could you help me to solve this problem?

Many thanks
giancarlo

#!/bin/sh

# Name of Script that will be show in log file ##############################################################
ScriptName='CheckLinkScript_Ze2-NS2'
# Remote Interface IP Address ##############################################################
RemoteIPAddress="10.15.100.222"
# Local Port connected to Remote IP Address ##############################################################
LocalPort="fe-2/0/1.23"
# Variable used for show time on log file ##############################################################
RIGHT_NOW=$(date +"%x %r %Z")
# Time between ping to Remote IP Address ##############################################################
SleepingTime='3'
# When interface is down after RentryTime will be sut up and Attemp of ping will be performed ##############
RetryTime='1000'


subping ()
{
echo ---$RIGHT_NOW---$ScriptName---- PERFORMING LINK CHECK RemoteIP $RemoteIPAddress LocalPort $LocalPort -- >> /var/log/messages
ping -c1 $RemoteIPAddress
if [ $? -ne 0 ]

# when is down #################################################################################################### ##
then

echo ---$RIGHT_NOW---$ScriptName---- Remote IP address $RemoteIPAddress unreachable -- > /var/log/messages
echo ---$RIGHT_NOW---$ScriptName---- Shutting down port &LocalPort -- > /var/log/messages
cli <<END_SCRIPT
edit
set interfaces $LocalPort disable

# shut interface ####################################################################################################


commit
top
exit
exit
echo ---$RIGHT_NOW---$ScriptName---- Port &LocalPort Admin DOWN -- > /var/log/messages
END_SCRIPT

sleep $RetryTime

# after sleep try to put up interface and try again to ping ##########################################################

echo ---$RIGHT_NOW---$ScriptName---- Attempt to recover link on port &LocalPort -- > /var/log/messages
cli <<END_SCRIPT
edit
dele interfaces $LocalPort disable
commit
top
exit
exit
END_SCRIPT



# when is up #################################################################################################### #####
else
echo ---$RIGHT_NOW---$ScriptName---- LINK CHECK Performed RemoteIP $RemoteIPAddress : OK -- > /var/log/messages
fi
}


while [ true ]
do
subping

sleep $SleepingTime



done