Skip to content
DataMiner Dojo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Learn more about Agile
        • Agile Webspace
        • Everything Agile
          • The Agile Manifesto
          • Best Practices
          • Retro Recipes
        • Methodologies
          • The Scrum Framework
          • Kanban
          • Extreme Programming
        • Roles
          • The Product Owner
          • The Agile Coach
          • The Quality & UX Coach (QX)
      • Book your Agile Fundamentals training
      • Book your Kanban workshop
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Program
    • DataMiner DevOps Support
    • Feature Suggestions
  • Downloads
  • Swag Shop
  • PARTNERS
    • Business Partners
    • Technology Partners
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

Prevent scheduled task script execution when script is still busy

25 views2 hours agoAutomation script Scheduler Task
0
Mieke Dryepondt [SLC] [DevOps Advocate]4.20K 2 hours ago 0 Comments

How can I make sure a scheduled task does not execute a new script run in case a previous one is still busy?

I have a scheduled task that runs every X minutes.
In rare / exceptional cases it is possible that the execution of the script takes longer than this time.
In those cases I rather have the next scheduled task trigger to skip the execution and wait until the running script has finished.
This to prevent an increasing load / queue of scripts running.

I also don't want to decrease the frequency of the scheduled task as in normal situations it would then not update fast enough.
I just have to cover the exceptional case.

Mieke Dryepondt [SLC] [DevOps Advocate] Answered question 2 hours ago

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
0
Mieke Dryepondt [SLC] [DevOps Advocate]4.20K Posted 2 hours ago 0 Comments

May I assume Scheduled task = configured on 1 specific agent. So it will always run automation in the same SLAutomation Process.
If that is the case, could I perhaps use the following:

private static int _isRunning = 0; // Script is launched from Scheduld task, make sure it
public void Run(IEngine engine)
{
	// No wait: immediate try-lock
	if (System.Threading.Interlocked.CompareExchange(ref _isRunning, 1, 0) != 0)
	{
		engine.Log("[WARNING] Script already running. Skipping this cycle.");
		return; // skip, do NOT wait
	}

	try
	{
		engine.SetFlag(RunTimeFlags.NoInformationEvents);
		RunSafe(engine);
	}
	finally
	{
		System.Threading.Volatile.Write(ref _isRunning, 0);
	}
}
Mieke Dryepondt [SLC] [DevOps Advocate] Answered question 2 hours ago
You are viewing 1 out of 1 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2026 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin