KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How do I start/stop my 4D 2004 Server as a Windows service?
PRODUCT: 4D Server | VERSION: 2004 | PLATFORM: Win
Published On: May 29, 2008
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

4D Server can run as a service on the Windows operating system. As a service you can set the server to startup automatically with the computer. You can also stop or restart the service from the command line.

The first thing you will need to do is register the database as a service (Note: Only one database can be registered as a service per machine). To do this choose "Register Current Database as Service" from the File drop down menu of 4D Server:



Once the database has been registered as a service, you may want to set the service to start up automatically. To do this first we need to get into Computer Management.

On XP/2000/2003 right-click on "My Computer" and choose Manage from the contextual menu.
On Vista right-click on "Computer" and choose Manage from the contextual menu:

XP:


Vista:


Once inside Computer Management, drill down on the left-hand side of the window to "Services and Applications" -> "Services". Once you have Services selected from the left-hand side of the window, your newly registered service should be listed with a display name of "4D Server: {Publication Name}" where {Publication Name} is the publication name listed in 4D Preferences:



Right-click on the display name "4D Server: {Publication Name}" (in this example our service is displayed as "4D Server: VideoGameHighScores") and choose Properties. From the properties window for the service you can set the service to startup automatically by changing the "Startup type" drop down field to Automatic. To start or stop the service from the command line you will need to know what the "Service name" is, this is different than the "Display name" - both can be obtained from the Service Properties window:



To start or stop the service from the command line, you will issue a NET STOP and/or NET START command (depending on what you are trying to do) followed by the "Service name" of your database. In the screenshots above our "Service name" is "4DS VideoGameHighScores.4DB". Notice the space in the service name; because of this we need to put quotes around the service name in our command:

NET STOP "4DS VideoGameHighScores.4DB"
NET START "4DS VideoGameHighScores.4DB"

Commented by Jesse Pina on June 19, 2009 at 11:39 AM
On Windows Vista, a service can no longer interact with the desktop. See the following tech tip for a few solutions to this issue: http://kb.4d.com/search/assetid=75714