How to stop a scheduled script execution ("On demand")

Stefan Baldhof1
Kilo Guru

Hi,

I created a scheduled script for testing purposes which is run only "On demand". Reason: I don't always want to test long running scripts via "Scripts - Background" as I'm stuck to this until the script finishes. But there's no possibility to stop such scheduled script once it is started - or does anyone know a way to do so?

1 ACCEPTED SOLUTION

Hi Stefan,



Here is what I found in my testing.   This was tested in a Helsinki Developers instance.   Can you please advise on any differences in the steps we are taking or what you are seeing?



1) Created a new Scheduled job with a simple loop to log a number (set the number high enough that I have time to go look before the script finishes):


basicLoop.PNG



2) Execute Now


3) Reviewed the User Administration > All Active Transactions:


Transactions.PNG



5) Killed the transaction


4) Checked the logs and confirmed that the log statements were no longer being generated.



Enjoy!


-Robert


View solution in original post

14 REPLIES 14

Hi Sergiu,



I tried this, but no matter how often I try to be logged in on the second node (in a different browser, after deleting all cached data) I always end up on the same node.


Hi Stefan,



If you try to login roughly in the same time via multiple browsers you should have a higher chance to land on different nodes.


Otherwise if you just can't get on the node where is runs, just call ServiceNow support line and they will help you to kill that job.



One other thing you can do to check on which node the job is running (while it's running):


- go to sys_trigger.list


- display all jobs that are running


- personalize the list view and add the Claimed by column. This column will show you exactly on which node your job is running.



Regards,


Sergiu


Hi Stefan,



You can try with multiple anonymous tabs, as an alternative to deleting caches - anonymous tabs have an empty cache.



Edit:


You could also try with different userids - each with admin role - there could be some "optimization" taking place where a specific userid has a better than random chance of hitting the same node.



Best Regards



Tony


Midhun1
Giga Guru

Hi Stefan,



Yes, You   need to go to particular node and kill that transaction.Usually operation team does this kind of activities, contact your operation team.


Stefan Baldhof1
Kilo Guru

Hi all,



sorry for my late reply, took some time 'til I was able to focus on that issue again   😉



Following your hints I was now able to find a running script in the "Active Transactions" overview and kill it from there successfully. I used the "Private window" function of Firefox to get a session on the other node.



Many thanks for all your help,


best regards


Stefan