@george1421 IT WORKS!!! (at least on the first system I tried )
so your code is MUCH more elegant than mine but it works.
Here is what I did to the script:
- I implemented a check on the interface using the code you started me on (like your code you just shared).
- I created an SQL update statement that updates two tables in the fog database:
# If the interface from fogsettings doesn't match what the system returned #
# Make the change so system can still function #
#---- Update the interface Setting ----#
$echo "The interface does not match the interface setting in $fogsettings, updating the interface Settings server-wide." >> $log
statement3="UPDATE \`globalSettings\` SET \`settingValue\`='$interface' WHERE \`settingKey\` IN ('FOG_NFS_ETH_MONITOR','FOG_UDPCAST_INTERFACE');"
statement4="UPDATE \`nfsGroupMembers\` SET \`ngmInterface\`='$interface' WHERE \`ngmMemberName\`='$storageNode' OR \`ngmHostname\`='$ipaddress';"
sqlStatements2="$statement3$statement4"
- adjusted the SQL execution to add in the new SQL statements:
# Builds proper SQL Statement and runs.
# If no user defined, assume root
[[ -z $snmysqluser ]] && $snmysqluser='root'
# If no host defined, assume localhost/127.0.0.1
[[ -z $snmysqlhost ]] && $snmysqlhost='127.0.0.1'
# No password set, run statement without pass authentication
if [[ -z $snmysqlpass ]]; then
$echo "A password was not set in $fogsettings for mysql use" >> $log
$mysql -u"$snmysqluser" -e "$sqlStatements" "$database" 2>> $log
$mysql -u"$snmysqluser" -e "$sqlStatements2" "$database" 2>> $log
# Else run with password authentication
else
$echo "A password was set in $fogsettings for mysql use" >> $log
$mysql -u"$snmysqluser" -p"${snmysqlpass}" -e "$sqlStatements" "$database" 2>> $log
$mysql -u"$snmysqluser" -p"${snmysqlpass}" -e "$sqlStatements2" "$database" 2>> $log
fi
4)updated the .ogsettings file to edit the interface entry:
#---- Update .fogsettings IP ----#
$echo "Updating the ipaddress field inside of $fogsettings" >> $log
$sed -i "s|ipaddress='.*'|ipaddress='$ip'|g" $fogsettings
$sed -i "s|interface='.*'|interface='$interface'|g" $fogsettings
Rebooted and opened the beb interface. All looks good!!!
Now, I just need to make/capture an image to prove all is working.
Thanks!!!