rchalk
Active Member
- Joined
- Feb 19, 2010
- Messages
- 403
- Reaction score
- 55
I installed TM3 on an older version of PBIAF (Silver) and everything works as expected, except the auto check and update feature. If I run ipchecker it updates iptables, but does not appear to do the restart, and ipchecker does not appear to run as specified in crontab. Running ipchecker and iptables-restart manually works fine.
Here is the ipchecker file as installed: FQDNs removed for privacy
Can anyone tell me if there are differences in crontab instruction format between different versions, or can you help me to get this working correctly?
Thanks
Richard
Here is the ipchecker file as installed: FQDNs removed for privacy
Code:
#!/bin/bash
# Insert the account filenames to be checked below
# Remember to increment the account[#] for new entries
account[0]=
account[1]=
account[2]=
account[3]=
account[4]=
account[5]=
account[6]=
account[7]=
account[8]=
account[9]=
account[10]=
account[11]=
account[12]=
account[13]=
account[14]=
account[15]=
account[16]=
account[17]=
account[18]=
account[19]=
account[20]=
# ipchecker (c) Copyright 2012, Ward Mundy & Associates LLC. All Rights Reserved.
#
# ipchecker 1.0 is licensed under the GPL2 license
#
# For a copy of license, visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# For additional information, contact us: http://pbxinaflash.com/about/comment.php
# Don't make changes below this line
cd /root
element_count=${#account[@]}
restartflag=0
index=0
while [ "$index" -lt "$element_count" ]
do
if [ ! -s "${account[$index]}" ]; then
echo "Ooops. ${account[$index]} not found."
ip="0.0.0.0"
test=$ip
fqdn=$ip
else
fqdn=`cat ${account[$index]} | cut -f 1 -d " "`
ip=`cat ${account[$index]} | cut -f 2 -d " "`
test=`dig +short $fqdn`
LEN=${#test}
if [ $LEN -gt 15 ]; then
echo "Ooops. We gotta a DIG overage problem. Forcing a match on IP to avoid disaster."
test=$ip
fi
if [ $LEN -lt 7 ]; then
echo "Ooops. We gotta a DIG fail problem. Forcing a match on IP to avoid disaster."
test=$ip
fi
if [ "$ip" = "$fqdn" ]; then
test=$ip
echo "Ooops. Missing FQDN. Entry ignored."
fi
fi
if [ "$ip" != "$test" ]; then
echo "Account ${account[$index]} CHANGED"
restartflag=1
echo " FQDN: $fqdn"
echo "OLD IP: $ip"
echo "NEW IP: $test"
echo "$fqdn $test" > /root/${account[$index]}
else
echo "Account ${account[$index]} OK"
fi
((index++))
done
if [ $restartflag -eq 1 ]; then
# service iptables restart
# iptables-restore /etc/sysconfig/iptables
iptables-restart
fi
exit 0
Can anyone tell me if there are differences in crontab instruction format between different versions, or can you help me to get this working correctly?
Thanks
Richard