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

"All active transactions" only shows my own transaction "looking at active transactions" (/v_transaction_list.do). Unfortunately there is no entry starting with "System Trigger" which references the running script   😞


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


Hi Robert,



steps are the same, but when looking at "All Active Transcations" there is no entry for the running job.


Stefan Baldhof1
Kilo Guru

Hi Robert, hi bhanu,



many thanks for your quick replys. I will take a look at it asap and give you feedback.


sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Stefan,



When you create a scheduled job, by default it will run on one of the available nodes. If your instance has more than 1 application node (which is the case for all production instances, which have at least 2) then if you go to All Active transactions you won't see that job unless you are logged in on the same node where it runs.



Logging in using multiple browsers (which would create different sessions) is one way to see if the job is there. This usually works well if you only have 2 application nodes, but if you have more, you need more than 2 browsers. Once you're logged in a node, just run stats.do and you will see on the second line the node where you're logged in, like:



Statistics for: Demo Server @ empspanaite.service-now.com:80 at: Sun Jul 24 01:01:01 PDT 2016 (Refresh)


Connected to cluster node: app128027.ams4.service-now.com:empspanaite006



Hope this helps.



Regards,