Hello All,
I am attempting to verify that a given script is not already running before attempting to start it so I don't inadvertently get multiple instances running at the same time.
My attempt is as follows:
:local SCRIPT "script1"
:local RUNNING [/system script job get [/system script job find where script=$SCRIPT] script]
:if ([:len $RUNNING] = 0) do={/system script run $SCRIPT}
What I have works correctly as long as the script is running, but if the script is not running what I have terminates prematurely at the end of line 2 with the output of "no such item".
Also, is there a way to run my script in line 3 that would allow the script being called, to run in the background and allow the startup script to terminate? In other words like starting a Linux process with the "&"
Thanks for the input.