You can open a file in your process and let it open.
If you cannot delete this file from another process, the process is still running.
When the file creating process has finished, it closes and delete the file. When the process crashes, you can delete the file, too.
I do this f.e. with login-files for every user.
filetime and filedate in directory
-
- Posts: 481
- Joined: Wed Jan 27, 2010 10:25 pm
- Location: Berlin Germany
Re: filetime and filedate in directory
_______________________
Best Regards
Wolfgang
Best Regards
Wolfgang
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: filetime and filedate in directory
Something like this is what I meantWolfgang Ciriack wrote: ↑Wed Aug 10, 2022 6:19 am You can open a file in your process and let it open.
If you cannot delete this file from another process, the process is still running.
When the file creating process has finished, it closes and delete the file. When the process crashes, you can delete the file, too.
I do this f.e. with login-files for every user.
Re: filetime and filedate in directory
hi Victorio,
as you can see there are People who have download Sample but other User get "file not found" ...
write me a private Message with your Email Adress so i can send Sample to you
it will not help in this Forum.
as you can see there are People who have download Sample but other User get "file not found" ...
write me a private Message with your Email Adress so i can send Sample to you
greetings by OHR
Jimmy
Jimmy
Re: filetime and filedate in directory
Wolfgang and Eugene:
I am testing it, but I am also dealing with the situation, when external process still run, but stay in cycle, or "frozen" .
In this situation read every x seconds last row from temporary "TIM" file and when actually time - last time from "TIM" file is more than for example 30 seconds, this is signal,
that external process not work.
Here is example temporary TIM file where external program write row every 1 second :
START na CPU : 2 - 20220810 14:59:47
AKTIV na CPU : 2 - 20220810 14:59:47
AKTIV na CPU : 2 - 20220810 14:59:48
AKTIV na CPU : 2 - 20220810 14:59:49
AKTIV na CPU : 2 - 20220810 14:59:50
AKTIV na CPU : 2 - 20220810 14:59:51
AKTIV na CPU : 2 - 20220810 14:59:52
AKTIV na CPU : 2 - 20220810 14:59:53
AKTIV na CPU : 2 - 20220810 14:59:54
AKTIV na CPU : 2 - 20220810 14:59:55
AKTIV na CPU : 2 - 20220810 14:59:56
AKTIV na CPU : 2 - 20220810 14:59:57
AKTIV na CPU : 2 - 20220810 14:59:58
STOP na CPU : 2 - 20220810 14:59:58
here is how read last time of activity and time difference
It will be interesting how it behaves on a server with heavy load and 12 core CPU
I am testing it, but I am also dealing with the situation, when external process still run, but stay in cycle, or "frozen" .
In this situation read every x seconds last row from temporary "TIM" file and when actually time - last time from "TIM" file is more than for example 30 seconds, this is signal,
that external process not work.
Here is example temporary TIM file where external program write row every 1 second :
START na CPU : 2 - 20220810 14:59:47
AKTIV na CPU : 2 - 20220810 14:59:47
AKTIV na CPU : 2 - 20220810 14:59:48
AKTIV na CPU : 2 - 20220810 14:59:49
AKTIV na CPU : 2 - 20220810 14:59:50
AKTIV na CPU : 2 - 20220810 14:59:51
AKTIV na CPU : 2 - 20220810 14:59:52
AKTIV na CPU : 2 - 20220810 14:59:53
AKTIV na CPU : 2 - 20220810 14:59:54
AKTIV na CPU : 2 - 20220810 14:59:55
AKTIV na CPU : 2 - 20220810 14:59:56
AKTIV na CPU : 2 - 20220810 14:59:57
AKTIV na CPU : 2 - 20220810 14:59:58
STOP na CPU : 2 - 20220810 14:59:58
here is how read last time of activity and time difference
poziciaaktiv:=rat("AKTIV",cSourcestring)
aktivdattim:=substr(cSourcestring,poziciaaktiv,poziciastop-poziciaaktiv)
aktivdat:=substr(aktivdattim,at("-",aktivdattim)+2,8) // dátum
aktivtim:=substr(aktivdattim,at("-",aktivdattim)+2+8+1,8) // čas
rozdieltime:=timetosec(time())-timetosec(aktivtim) // rozdiel oproti aktuálnemu času
It will be interesting how it behaves on a server with heavy load and 12 core CPU
Re: filetime and filedate in directory
Hi Victorio,
Two remarks:
- Writing every 1 second is maybe time consuming? And it makes your TIM file bigger which can also slow down the processing of the file to check if it is ready?
- If the word STOP is in the file, you are also sure it is finished.
Every millisec. can make a difference in this kind of program flow.
Two remarks:
- Writing every 1 second is maybe time consuming? And it makes your TIM file bigger which can also slow down the processing of the file to check if it is ready?
- If the word STOP is in the file, you are also sure it is finished.
Code: Select all
if !'STOP' $ cSourcestring
poziciaaktiv:=rat("AKTIV",cSourcestring)
aktivdattim:=substr(cSourcestring,poziciaaktiv,poziciastop-poziciaaktiv)
aktivdat:=substr(aktivdattim,at("-",aktivdattim)+2,8) // dátum
aktivtim:=substr(aktivdattim,at("-",aktivdattim)+2+8+1,8) // čas
rozdieltime:=timetosec(time())-timetosec(aktivtim) // rozdiel oproti aktuálnemu času
else
lFinished := .T.
endif
Re: filetime and filedate in directory
Chris,
1 second is only example, in real use this will be set to 10 or more minutes. my client add about 10 - 15 processes afternoon to run it at night. At morning he has results. But when some of process frozen, or crash, he has not any result. This solution I want use to prevent waiting main program to any process, which does not report for a longer time, and interrupts it to can run other process.
Because processes run on 12 core CPU, and use 100% his performance, sometimes one from it crashes, or freezes.
I am thinking of a better system that would use some windows system variable, without the need to create external files, which is a bit temporary, although functional.
It would be possible to use something in the registries, but sometimes there is a problem with access to loading and writing in different versions of windows.
I won't complicate my life with it for now
1 second is only example, in real use this will be set to 10 or more minutes. my client add about 10 - 15 processes afternoon to run it at night. At morning he has results. But when some of process frozen, or crash, he has not any result. This solution I want use to prevent waiting main program to any process, which does not report for a longer time, and interrupts it to can run other process.
Because processes run on 12 core CPU, and use 100% his performance, sometimes one from it crashes, or freezes.
I am thinking of a better system that would use some windows system variable, without the need to create external files, which is a bit temporary, although functional.
It would be possible to use something in the registries, but sometimes there is a problem with access to loading and writing in different versions of windows.
I won't complicate my life with it for now