Running TIBCO Cloud™ - Proxy Agent as a Background Windows Task

You can start TIBCO Cloud - Proxy Agent as a Windows background process that can be gracefully stopped by using the taskkill Windows command. TIBCO recommends running it as a Windows service on production systems. However, there are cases when this is not feasible, for example, in development environments.

Note: In Windows, a background process remains attached to the parent process. This means that a background process that you start by using start /b automatically ends when the parent process ends. If the parent is a command prompt window, closing the command prompt ends the background processes too.

Assumptions

  • A directory C:\TIBCO\tunnel exists and the log file is stored in the same directory.

  • The AccessKey has been created and you know the <AccessKey Secret> and the ConnectURL associated with it.

    Procedure
  1. Open a Windows command prompt as an Administrator.

  2. Set up the following environment variables and ensure to set the values for TIBTUNNEL_ACCESS_KEY_SECRET, TIBTUNNEL_SPECS, and TIBTUNNEL_CONNECT_URL to match your environment:

    set TIBTUNNEL_LOG_FILE=C:\TIBCO\tunnel\tibtunnel-service.log
    
    set TIBTUNNEL_PROFILE_NAME=tutorial
    set TIBTUNNEL_SPECS=-s 8080:localhost:8080 -s 7771:localhost:7771
    set TIBTUNNEL_ACCESS_KEY_SECRET=<your AccessKey secret>
    set TIBTUNNEL_CONNECT_URL=<your connectURL>
  3. Configure a TIBCO Cloud - Proxy Agent profile using your AccessKey:

    tibtunnel.exe configure --profile %TIBTUNNEL_PROFILE_NAME% --accessKey %TIBTUNNEL_ACCESS_KEY_SECRET%
    
  4. Start TIBCO Cloud - Proxy Agent as a background process by using the Windows command start /b.

    start /b  tibtunnel.exe connect --log-file %TIBTUNNEL_LOG_FILE% --profile %TIBTUNNEL_PROFILE_NAME% %TIBTUNNEL_SPECS% %TIBTUNNEL_CONNECT_URL% 
    sc description %TIBTUNNEL_SERVICE_NAME% "%TIBTUNNEL_SERVICE_DESCRIPTION%"
    sc start %TIBTUNNEL_SERVICE_NAME%

The TIBCO Cloud - Proxy Agent} process runs as a background process. Keep the command window open (closing it forcefully kills the background process).

Find the Process ID

Find out the process ID of the background TIBCO Cloud - Proxy Agent service:

tasklist /FI "imagename eq tibtunnel.exe"

The output of the above command lists the process ID (that is the PID) of the TIBCO Cloud - Proxy Agent service. For example, in the following sample output, the PID is 2468:

Image Name PID Session Name Session# Mem Usage
tibtunnel.exe 2468 Console 1 14,440 K

Stop a service

Stop the TIBCO Cloud - Proxy Agent background service by using the taskkill command. For example, if the PID is 2468, give the following command:

taskkill /T /PID 2468