KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to restart 4D Web Server with current Web Processes termination option
PRODUCT: 4D | VERSION: 15.x | PLATFORM: Mac & Win
Published On: August 16, 2017

When stopping 4D Web Server, it is important to know that this action has no impact on all existing Web processes. This means that when 4D Web Server has restarted, the existing Web sessions will continue to run without having to reestablish a new Web process for them.

In some cases, terminating all existing Web processes prior to restarting the Web Server may be needed. Here is a utility method with current Web Processes termination option.

  // ----------------------------------------------------
  // Method: utilRestartWebServer
  // Description
  //   Restart 4D Web Server
  //
  // Parameters
  // $1 (optional) - True, Terminate all Web Sessions before restarting
  // ----------------------------------------------------


C_BOOLEAN($1;$terminateAllSession_b)
C_LONGINT($value_l)

If (Count parameters>=1)
  $terminateAllSession_b:=$1
End if

WEB GET OPTION(Web keep session;$value_l)

If ($terminateAllSession_b) & ($value_l=1)
  WEB SET OPTION(Web keep session;0)
End if
WEB STOP SERVER

If ($terminateAllSession_b) & ($value_l=1)
  WEB SET OPTION(Web keep session;1)
End if
WEB START SERVER