I am calling from my Java EE application through ssh (apache) Powershell script on remote server, this script cannot be run in parallel so I need to check if the script is already running and wait until there is no process and run that waiting script. It might happen that the script will be called several times, eg. 20 times in few seconds and all of these needs to be run one by one.
Any idea how this can be achieved or if this is even possible? Thank you!