A tool to gracefully stop and restart remote applications, in order to unlock the executable on a shared drive and allow its replacement.
AppWatcher is a Delphi component that allows an application to be remotely controlled by a dedicated supervisor application included in the solution.
It is designed for developers and IT administrators who need to:
- Gracefully stop applications
- Deploy to a shared folder
- Restart them remotely
All of this without using RDP or physically accessing each machine.
βοΈ Easily stop running applications on remote machines
βοΈ Deploy application updates with minimal disruption to users
βοΈ Notify users before stopping an application
βοΈ Automatically copy apps from one source to specific destinations
βοΈ Restart applications automatically after an update
βοΈ Avoid using RDP (Remote Desktop) or physically moving between machines
βοΈ Minimize downtime and streamline the deployment process
β
Remote application shutdown with a simple command.
β
Configurable countdown before shutdown to notify users.
β
Controlled application restart after an update.
β
Multilingual support (French & English).
β
Configurable settings via INI files.
β
Communication via Indy TCP/IP and Named Pipes for secure messaging.
β
Lightweight and efficient β does not require admin privileges.
β
New (v2.0): Application deployment β automatic and optimized copying of executable files.
β
New (v3.0): New architecture using Named Pipes for local communication between Clients and the Agent.
β
New (v3.0): New AppWatcherStub
utility to relaunch the Agent after it has been stopped.
β
New (v3.1): Backup of replaced executables with rotation and recovery management.
-
Delphi 10.2 Tokyo β Delphi 12 Athens
-
Windows 32-bit or 64-bit
-
Raize Components library (for
TRzNumericEdit
)- β If you have Delphi 10.2+ Professional/Enterprise, Raize Components may already be included.
- π Otherwise, install Raize Components manually or replace
TRzNumericEdit
with a standardTSpinEdit
(requires minor UI adjustments).
-
Indy Components (comes with Delphi by default)
-
NamedPipesForDelphi (already included inside AppWatcher sources)
--
AppWatcher consists of three main components:
-
π₯οΈ AppWatcher Master β The central server that:
- Communicates with all Agents and keeps track of their presence.
- Lists all applications managed by the Agents (i.e., applications using the
TAppWatcherClient
component). - Allows administrators to remotely stop applications, while giving users a countdown before shutdown.
- Supports cancellation of a STOP request before the countdown expires.
- Can request all managed applications to restart after an update.
- Can request all Agents to shut down.
- New (v3.0): AppWatcherStub utility to allow restarting agent after stopping it.
- New (v2.0): Manages the list of applications to deploy via a dedicated interface.
- New (v2.0): Sorting and filtering to display only the applications to deploy.
- New (v3.1): Backup of replaced executables with rotation and recovery management.
-
π₯οΈ AppWatcher Agent β A lightweight background application running on remote machines that:
- Listens for commands from the Master.
- Communicates with local applications using the AppWatcher Client component.
- Notifies users and requests applications to stop when an update is needed.
- Maintains a local list of applications to restart after an update.
-
π₯οΈ AppWatcher Client Component β A Delphi component (
TAppWatcherClient
) that:- Allows an application to communicate with the local Agent with minimal programming effort.
- Handles STOP requests requested by the Master and transmitted by the Agent.
- Gives the developer control over whether to accept or refuse the STOP request, based on the application's state.
- Provides command-line parameters that the Agent will use when restarting the application.
- Ensures a clean shutdown and possible restart after an update.
- Simplifies integration of AppWatcher into Delphi applications with minimal coding.
β This application was originally developed in Delphi v12.2.
Depending on your Delphi version, please open the appropriate package:
Delphi Version | Package to open |
---|---|
Delphi 10.2 Tokyo / 10.3 Rio | AppWatcherClientPackage_Pre104.dpk |
Delphi 10.4 Sydney and later | AppWatcherClientPackage.dpk |
Important:
{$LIBSUFFIX 'Auto'}
is supported only from Delphi 10.4 onward.- Using the wrong package may cause build or linking errors.
π Special thanks to limelect for his help in adapting AppWatcher to Delphi 10.2 compatibility.
π Precompiled binaries are available for quick testing without compilation. π Download here
If you are building AppWatcher from source:
- All
.dproj
and.groupproj
files have been removed to avoid Delphi version conflicts. - You must manually open and compile the
.dpk
and.dpr
files inside your version of Delphi. - Please follow the detailed guide in BUILD_INSTRUCTIONS.md.
π It explains:
- How to open the right packages (
.dpk
) - How to install the component
- How to configure Delphi's Library Paths correctly
- How to rebuild the missing
.dproj
or.groupproj
files if needed.
- Run
AppWatcherMaster.exe
on the machine that will act as the control center. - The Master automatically updates its IP address in the
AppWatcher.ini
file. - Agents regularly read the INI file to locate the active Master.
- No manual configuration is needed unless you want to change the default port.
- The last Master started on the network takes control.
- Copy
AppWatcherAgent.exe
to all machines that need remote control. - Run the Agent, and it will appear as an icon in the system tray (notification area).
- Double-clicking the icon opens the log window, which displays connection status and received commands.
- Right-clicking the icon opens a menu that allows you to exit the Agent, but:
- To prevent users from stopping the Agent, exiting is protected by a password.
- The current password (not secure) is
appW
.
- Closing the log window using the "X" button does not stop the Agent β it simply hides the window.
- To fully exit the Agent, hold SHIFT + CONTROL while clicking the "X" button to display the password prompt.
- The Agent automatically reads the INI file to locate the active Master.
To make a Delphi application controllable by AppWatcher, follow these steps:
-
Install the
TAppWatcherClient
Component:- Open
AppWatcherClientPackage.dproj
in Delphi. - Compile and install the package.
- Add the component's source path to Delphi's library paths (Tools β Options β Library β Library Path).
- Open
-
Add
TAppWatcherClient
to Your Applications:- Place a
TAppWatcherClient
component on main form in all applications you want to manage. - The component allows the application to communicate with the local Agent and respond to STOP commands.
- Place a
-
Handle STOP Requests (Prevent shutdown if needed):
- Implement the
OnStopRequested
event to prevent the application from closing if, for example, it has unsaved data. - Example:
procedure TFormMain.AppWatcherClient1StopRequested(Sender: TObject; var CanStop: Boolean); begin if UnsavedChanges then CanStop := False // Prevent shutdown if data is not saved else CanStop := True; // Allow shutdown end;
- Implement the
-
Define Restart Parameters (Command-line arguments for relaunching the app):
- Use the OnGetAppParams event to send command-line parameters that the Agent should use when restarting the application.
- Example:
procedure TFormMain.AppWatcherClient1GetAppParams(Sender: TObject; var Params: string); begin Params:=''; if TestMode then Params := '/Mode=test'; // Example parameter end;
AppWatcher uses INI files for its configuration and an AppWatcher.json file (to store the list of applications to deploy). These files must be accessible by the application to ensure proper operation.
π Where does AppWatcher look for files?
β In the application's runtime directory (e.g. C:\Program Files\AppWatcher\
).
β In a Config\
subdirectory of the runtime directory (e.g. C:\Program Files\AppWatcher\Config\
).
β By following Windows shortcuts (.lnk
): If a .ini
file is not found directly, AppWatcher checks if a .lnk
shortcut with the same name exists and follows its target.
π‘ If AppWatcher.ini
is missing, the application will display an error message.
The AppWatcherClient.dproj
application is provided to test the integration of the TAppWatcherClient
component without modifying your own application.
- It includes a
TAppWatcherClient
component configured to receive and display commands sent by the Agent. - When a STOP command is received, the application can accept or refuse shutdown via the
OnStopRequested
event. - It also allows you to simulate sending restart parameters using the
OnGetAppParams
event. - All received actions and messages are displayed in a log window (
Memo1
) for monitoring and analysis. - The test application also includes a second form (opened via the "Second Form" button) which also contains a
TAppWatcherClient
component.- This demonstrates that only the component on the MainForm handles STOP requests.
- A
TAppWatcherClient
placed on a secondary form will not work, as the main application window takes priority. - This allows for flexible UI design where a window may act as the MainForm in one application but as a secondary form in another.
This tool allows you to test AppWatcherβs functionality before integrating TAppWatcherClient
into your final applications. π
πΌ Icons Attribution:
Some icons used in this project are from Icons8. As per Icons8's licensing, attribution is required unless you have a paid subscription.
π Named Pipes Library:
This project integrates the excellent NamedPipesForDelphi library, originally created by Russell and published by Tobias Giesen under The Unlicense.
The source has been modularized into three units (PipesCommon
, PipeClient
, PipeServer
) for better integration into AppWatcher.
The full version history is available in Changelog.md.