AppDog

Applikations-Watchdog

AppDog is a freeware utility from Shamrock Software for Windows 2000, XP, Vista, 7, 2003, 2008. Shamrock does not offer hotline support for freeware and does not guarantee its functions for a specific operation environment. Distribution of the software in the Internet or on media requires a written and explicit approval from Shamrock. Selling the software for money is prohibited.

Download of the current AppDog version - German manual

AppDog version history
Version Date Changes
1.56
1.55
1.51
1.50
1.42
1.41
1.40
1.31
1.26
1.23
1.12
1.11
1.10
1.07
1.04
1.03
1.00
07.03.19
09.06.17
23.10.13
24.05.13
28.05.08
25.05.07
27.06.06
22.11.05
15.12.04
10.05.04
12.06.03
27.03.03
10.02.03
07.02.02
16.03.01
17.01.01
14.09.00
Optional exakt window titel check Optimisations
Filesync access errors in Appdog.txt
Separate status line for FileMove
AppDog window title no longer checked for multi-instace
.LOK file avoids multiple AppDog instances
[ByTitle] now uses WM_NULL messages
[x] only minimizes AppDog
FileMove and FileAppend functions
Backup function: appdog.ini, [Filesync]
Auto boot (42 days) can be deactivated
Disable/enable program in context menu
Popup messages use mailslots instead of NetBios
AppClose displays all windows titles or kills applications
Errors.txt is written for severe errors
Application error windows will be closed automatically
First version, including ping-pong function


Purpose and Functions

AppDog ensures that all required applications on a Windows PC are running 24 hours a day, 7 days a week. Typical examples are voicemail, fax or e-mail servers.

There are two ways in which AppDog checks if applications are running. Programs specifically designed for AppDog can answer simulated keyboard strokes with a Windows messages to Appdog (ping-pong) to show that they are fully operational. If AppDog detects that such a program is loaded, but does not respond to keystrokes, the program will be killed and restarted automatically.

Other applications can be watched by checking if the window title exists as configured in AppDog, and if the program is accepting Windows messages. This does not necessarily mean that it works correctly, but it is at least still running. If the window title is not found, AppDog will try to restart the program.

In addition, AppDog comes with a built-in backup function. In configurable intervals, files from predefined source folders are copied to a backup PC over the network.

Since Windows' 32-bit millisecond timer wraps after 49.7 days and some applications might have timing problems in this situation, AppDog can reboot the PC after at least 42 days (or a different day count) - but never on a Saturday or Sunday and only between 8 and 13 hours local time (i.e. during typical business hours). The function is disabled by default, using AutoRebootPeriod=0 in appdog.ini.

To connect external alarm devices, AppDog can be configured to generate a 500-Hz square wave signal on the TxD pin of a COM port.

Installation and Operation

Unpack ZIP file

The downloadable file AppDog.zip contains AppDog.exe (the watchdog application) and AppDog.ini (the configuration file), AppDog$.htm (this manual). Another application, AppClose.exe, can be used to show a list of all current window titles (some may be invisible on the desktop, though) or to kill an application (use the window title as command line argument, optionally abbreviated).

Unpack AppDog.zip to a folder of your hard disk. If you are using the NetMail program from Shamrock, we recommend that you put the files in the existing NetMail folder.

Configuration in AppDog.ini

AppDog is configured using a text file AppDog.ini. Uppercase or lowercase is ignored. A sample with some remarks:

[Common]
WatchCom=COM1
Warning=15
AutoRebootPeriod=0 (or day count)
Common settings:
Generates 500 Hz on COM1-TxD
Seconds until red warning line appears
No auto-boot after 42 days
[ByMessage]
NetMail-Router=c:\netmail\gateway.exe
NetMail-Mailer=c:\netmail\mailer.exe
CapiCall PRO - Voiceserver=c:\capicall\cc_serv.exe
CapiFax-Server=c:\capifax\cfax_srv.exe
Shamrock CapiDog|=c:\capicall\capidog.exe
Programs with ping-pong support:
The window title of a program is left of
the equal sign (or a unique part of it),
and the executable path and file is right
of it. The window title is required so
that AppDog can identify the program.
By attaching the symbol | at the end of the
window title the string check needs a complete match.
[ByTitle]
System Monitor=c:\windows\sysmon.exe
Programs without ping-pong support:
Same line structure as above
[FileSync]
Writelog=1
AutoTime=60
AutoTimeDel=90
MinimumAge=60
1=SourcePath1\*.*,DestinationPath1\
2=SourcePath2\*.*,DestinationPath2\
(more groups possible: 2_... etc.)
Optional file-backup configuration:
Create log file Filesync.txt
Backup interval in minutes
Deletion interval if backup not possible
Minimum age [min] of files to backup
Source and destination path/mask 1
Source and destination path/mask 2
More groups (if required)
[FileMove]
1=SourcePath1\*.*,DestinationPath1\
2=SourcePath2\*.*,DestinationPath2\ (etc.)
Optional file move configuration:
Files from the source path are moved
to the destination folder once a minute
[FileAppend]
1=SourcePath1\*.*,DestinationPath1\
2=SourcePath2\*.*,DestinationPath2\ (etc.)
Optional file append configuration:
Files from source path are appended to
matching destination files once a minute

With AppDog, it is no longer required to put the applications into the Start-up folder. A simple startup link to AppDog.exe will do the job when Windows is rebooted.

When you right-click an application in the AppDog window, a context menu opens which allows to end or start a program. "End all" will quit all programs and AppDog itself. To quit AppDog only, right-click on the AppDog symbol in the system tray, and a context menu will appear.

AppClose displays a list of all currently active programs with their window titles. Typically some are invisible on the screen. You can also kill a program by writing its window title into the command line behind AppClose. The window title can be abbreviated, as long as it matches any part of the title bar.

Ping-Pong Function

AppDog checks applications configured below [ByMessage] in AppDog.ini by sending them a keystroke with an ASCII value of 160 about every 5 seconds and expects an answer within a few seconds using the Windows message API.

The PostMessage( ) function of Windows uses two parameters. The first one must be the window handle (hwnd) of the application to be watched, so AppDog knows where an answer comes from. The second parameter should be 0, if the application is idle and can be ended without losing data or breaking connections, or 1 (or the number of connections) if the program is busy.

Typically only programs from Shamrock or self-programmed applications support this mechanism. Others have to be configured at [ByTitle] instead of [ByMessage]; AppDog will check their function by sending null messages to them, just as the Windows Task Manager does.

Backup Function

In addition to its watchdog function, AppDog can be used to copy files from the local hard disk to a backup PC over the network. This is configured using the optional section [FileSync] in AppDog.ini. You can enter several source and destination folders, each with a file mask. The backup will copy files recursively, including all folders below the source folder, and creates destination folders as required. The destination path can be in UNC form (like \\server\c\backup\) or a path on a mapped network drive (like n:\backup\).

Copying of files takes place only if all watched [ByMessage] applications say that they are idle. Since NetMail uses temporary folders ending with .DIR or named \Received\, such folders will not be copied at all.

If files cannot be copied for a long time (60 minutes in the sample above) because some applications are not idle yet, AppDog will at least try to delete files on the destination drive which do no longer exist on the source drive after some time (90 minutes in the sample), since the deletion typically does not cause access conflicts.

You can enable a log file by writing Writelog=1 below [FileSync] in AppDog.ini. This file has the following line structure:
10.05.04 09:01:34  12s 835 (48 MB) -29 +11 (+35)
In this case, the backup took 12 seconds. 835 files where checked on the source drive, their over-all size was 48 MB. 29 files where deleted on the destination drive since they did not longer exist on the source drive, and 11 new or changed files were copied to the destination. 35 files were not copied because they were too young (MinimumAge parameter).

Uninstalling AppDog

AppDog does not create or change entries in the Windows registry. So all you have to do for uninstalling AppDog is delete all files matching the mask AppDog.*.

Questions and Answers

Which applications support the ping-pong function?

Currently the following Shamrock programs support the [ByMessage] mechanism: CapiDog, CapiFax (fax server), CapiCall (voice and SMS server modules), NetMail (mailer.exe, gateway.exe, transfer, Rs2file), and WinTel (host32).

Any special hints for Windows?

If you are using Windows XP and later, you should disable the error reporting option in the control panel, so no message box has to be confirmed manual when an application causes an error.

Is it possible to send an SMS if an error occurs?

After severe errors, AppDog will write a line into Errors.txt. If you have NetMail installed and AppDog is in the same folder, the alarm option of the NetMail gateway program can be used to send an SMS. If you have CapiCall from Shamrock in addition, a phone call can be initiated alternatively.

How can I implement the ping-pong function in a Visual Basic program?

Add the following code in the common section of your VB program:

Private Declare Function PostMessage _
  Lib "user32" Alias "PostMessageA" _
  (ByVal hwnd As Long, ByVal wMsg As Long, _
  ByVal wParam As Long, ByVal lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias _
 "FindWindowA" (ByVal lpClassName As String, _
  ByVal lpWindowName As String) As Long

Then use this code for the Form_Keypress event:

Private Sub Form_KeyPress(KeyAscii As Integer)
 Dim h&, r&, busy&
 If KeyAscii = 160 Then 'Message von AppDog
  busy = 0 'Darf jederzeit neu gestartet werden
  h = FindWindow(vbNullString, "AppDog")
  If h Then r& = PostMessage(h, 1028, Form1.hwnd, busy)
 End If
End Sub

© Shamrock Software GmbH