October 06, 2015
Sometimes after Backup and Restore scripts are run, Zephyr application is not restarted properly.
The scripts backup.sh and restore.sh calls the wait_for_port() to wait for a max of 180 sec, until all connections to port 443 are made(even the TIME_WAIT ones).
In wait_for_port() the pattern ':443' while grepping in the line we can observe the pattern in the below line of the script
cmdval=`/bin/netstat -nal | egrep -v 'LISTEN' | egrep '^tcp' | egrep ':443' | sed -r 's/[ ]+/ /g' | cut -d ' ' -f 1,4,6 | sort | uniq -c | sort -rn`
As there is no space at the end, ':443' matches all the other ports starting with 443 for example ":44390" or ":4431".
Due to this, wait_for_port() sometimes fails after timeout and the script then does not restart the application.
Edit the back up script to add a space after 443 ie ':443 ' and save the file.
Updating backup.sh and restore.sh scripts with the space after 443 i.e, egrep ':443 ' will now return only one accurate value which has the port number 443, required for Zephyr application to restart the properly.
The whole command will now look like the below in backup and restore scripts.
cmdval=`/bin/netstat -nal | egrep -v 'LISTEN' | egrep '^tcp' | egrep ':443 ' | sed -r 's/[ ]+/ /g' | cut -d ' ' -f 1,4,6 | sort | uniq -c | sort -rn`
Title: Troubleshooting Zephyr application after backup or restore are done
Product: Zephyr Enterprise/Community Edition.
Version: Till current version.
Summary: Update the script to restart the application.