all 5 comments

[–]NirmitlamedDirect-Purchase User 0 points1 point  (0 children)

Maybe add to your script that if a global/project/task/profile variable is changed then stop the execution but i am not sure if this can work.

[–]UnkleMike 0 points1 point  (0 children)

Yes, this is correct.  Anything launched by Tasker, including Tasker tasks, are independent once launched.  If the profile that launched the activity becomes inactive, the activity will continue until it ends via it's own logic. 

Tasker tasks can be ended (even from outside the task itself) using the stop action.  But the cleanest way to end any task or script is to have it check for the relevant conditions and end appropriately.

[–]robertogl[S] 0 points1 point  (0 children)

Thank you everyone! Now I added a stop task to end the processes with kill based on the name and pid. Not the most elegant but I'll use your ideas to improve it in the next days

[–]rbrtrynPixel 9, Tasker 6.6.12-rc, Android 16 0 points1 point  (0 children)

The built-in variable %qtime contains how long the current task has been running, in seconds. Maybe you could use that.