prevent the script from running if it is already running



No matter what is the script name, just make unique the UniqueScriptID…

:local UniqueScriptID "QnJhdm8h"
:local ThisScriptName [/system script get ([find where source~"$UniqueScriptID"]->0) name]
:local AlreadyRunning "Script $ThisScriptName already running"

:if ([:len [/system script job find where script=$ThisScriptName]] > 1) do={:log error $AlreadyRunning; :error $AlreadyRunning}

# simulating script running for 60 seconds
:delay 60s