- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2023 04:07 AM
Hi All,
Can anyone help me to write script for kill the scheduled jobs running more than 30 mins.
we have option to manually kill but we need to automate by checking the age > 30 mins
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2023 06:59 AM
Hi @Dhanu1,
Try this code
var trigger = new GlideRecord('sys_trigger');
trigger.addQuery('state',1)//state is running
trigger.addQuery('processing_duration','<','1800000')//scheduled jobs running more than 30 mins
trigger.query();
while(trigger.next()){
GlideTransactionManager.kill(current.session_id);
}
​If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
Regards
Mohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2023 06:59 AM
Hi @Dhanu1,
Try this code
var trigger = new GlideRecord('sys_trigger');
trigger.addQuery('state',1)//state is running
trigger.addQuery('processing_duration','<','1800000')//scheduled jobs running more than 30 mins
trigger.query();
while(trigger.next()){
GlideTransactionManager.kill(current.session_id);
}
​If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
Regards
Mohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 10:28 PM
where can we use this script ? can we use it directly into the scheduled job to check if it is running for more that 30 minutes ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2025 04:51 AM
GlideTransactionManager.kill(session_id); is not working in script background
.