I have written ruby script which I put in cronjob and need to prevent running the same script if there is a process already running on the same script. Basically I am trying to prevent running duplicate process for the same script and if the script is not actually running then only it has to run.
I tried with flock but I think it locks file for writing purpose only. Like if any of the process already writing a file then no other process can write the same file.
Somehow I managed this by checking the running process if any contians the script name if not then only the process will start. But wondering is there any builtin module in Ruby which can take care of this thing.