Hi Arnaud,
I’m doing a similar thing, but a little more sophisticated...
From my 4D ‘to be watched’ processes, I write the last date and time of
execution. Then I have a watchdog AppleScript which checks the datetime and
sends an email if something is wrong.
Finally a crontab entry launches the AppleScript every … minutes.
AppleScript: =========================
-- read deamon file content subroutine
on readDaemonFile(thePath)
tell application "Finder"
try
if exists file thePath then
set fileExists to true
else
set fileExists to false
end if
end try
end tell
if fileExists then
set theFile to (open for access file thePath)
set theText to (read theFile for (get eof theFile))
close access theFile
else
set theText to ""
end if
return theText
end readDaemonFile
on alertDaemon(theDaemonName, theDBName, theText)
set maxTime to 1 * 60 * 60 --max 1 hour
if theText is not equal to "" then
set dimonaTime to date (theText)
if (((current date) - dimonaTime) > maxTime) then
sendMail(theDBName & " " & theDaemonName & " *** daemon
probleem.", “Last run: " & theText)
else
--all is fine
end if
else
sendMail(theDBName & " " & theDaemonName & " *** daemon
probleem.", "Daemon not active.")
end if
end alertDaemon
-- check dimona daemon
set pathDaemonaFile to "Macintosh HD:Batch:dimona_deamon.txt"
alertDaemon(“MyProject", "DIMONA", readDaemonFile(pathDaemonaFile))
AppleScript: =========================
Kind regards,
Koen
> Op 13 aug. 2017, om 16:49 heeft Arnaud de Montard via 4D_Tech
> <[email protected]> het volgende geschreven:
>
>> I have 4D Client running as a web server on windows. I have the client
>> write a text file every 45 seconds or so to disk. I then have a batch
>> script that runs every minute and looks for that file and deletes it. If
>> the file is not found it kills the 4D task and restarts 4D Client.
>
> Something similar on macOS, someone?
--------------------
Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Knesselare
Belgium
tel +32 495 511.653
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************