Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I keep thinking there is a better way to flag a process is running. Maybe a temp file that gets cleaned up on restart?
How did you fix this?! -
@Demolishun Had to calculate the name of the temp file by generating a SHA1 of the process name and it's arguments. Then locate the file and remove it.
I think a script at shutdown / reboot that cleaned the directory would be a great addition -
@StyxOfDynamite Just do it in a sane way. Use a file lock, mutex, whatever. Filesystem isn't even atomic, it's a terrible choice for locking.
-
check the lock file creation time and allow a time limit for the lock. Considering the maximum execution time of your process
If the lock time exceeds, recreate the lock start the process and notify someone
It might work for you. I use it all the time -
@DreamWave Or, you know, just use a reliable, foolproof method built into your OS instead of relying on homebrew hacks that impose artificial limitations such as lock time.
Related Rants
-
Angry21The first time I realized I wasn't as good as I thought I was when I met the smartest dev I've ever known (to ...
-
Flink9122Professor: "Who here regularly backs up all their data?" *Some people raise their hands* Professor: "Who has a...
-
sagemaker32I was looking for about a month for a laptop. Then on this one magical day I open kijiji and see a Toshiba Thi...
Monday morning we found out our main event queue hadn't processed since late Wednesday afternoon. Shit was hitting the fan and we were stumped. What had changed?!?. Why wasn't the queue processor running?!?
Turns out a server restart had killed the job (no worries there, surely?!) but turns out the job checked for a system flag on disk to stop it running multiple instance or in this case as the flag was still present any instance at all. Got to love the little things that really screw you over.
rant
story
shit hit the fan
problem