Index: /branches/rel_apv_10_7/usr/click/bin/sync/remote
===================================================================
--- /branches/rel_apv_10_7/usr/click/bin/sync/remote	(revision 38355)
+++ /branches/rel_apv_10_7/usr/click/bin/sync/remote	(working copy)
@@ -271,6 +271,12 @@
 						fi		
 					elif [ "$2" = "to" ]
 					then
+						# Bug 786_PATCH_START
+						# Make a backup of /var/run/webui_server.pem before Sync
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -x '/usr/bin/chown ansync:root /var/run' > /dev/null 2>&1"
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -x 'cp -f /var/run/webui_server.pem /var/run/webui_server_backup.pem' > /dev/null 2>&1"
+						# Bug 786_PATCH_END
+					
 						#sync to is a push configuration operation.
 						#1. create config dir
 						#2. modify config dir attribute
@@ -287,6 +293,16 @@
 						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -x '/usr/bin/chown ansync:root /home/ansync/.ssh' > /dev/null 2>&1"
 						/ca/sync/sync $9 to "" $6 $dst_ip $segment_name > /ca/sync/log/$9.log
 						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/sync $9 load_config \"\" $6 $dst_ip $segment_name $segment_user > /ca/sync/log/$9.log"
+
+						# Bug 786_PATCH_START
+						# Copy the webui_server_backup.pem (created before Sync) with the original webui_server.pem, and delete the backup file
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -x 'cp -f /var/run/webui_server_backup.pem /var/run/webui_server.pem' > /dev/null 2>&1"
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -x 'rm -f /var/run/webui_server_backup.pem' > /dev/null 2>&1"
+						# Webui Off and On for reloading the certificate on browser
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -l 'webui off' -f "config" > /dev/null 2>&1"
+						$SYNC_CMD $SYNC_OPT $dst_ip "/ca/sync/munch -l 'webui on' -f "config" > /dev/null 2>&1"
+						# Bug 786_PATCH_END
+
 					elif [ "$2" = "incto" ]
 					then
 						#sync increment to is a push configuration operation.
