Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


faulk
  •  faulk
  • No customer Topic Starter
2010-10-21T17:50:15Z
Hi,

I use file triggers based on network directory (UNC path). My issue is that if the connection is lost, the trigger was inactivated due to an error (and the trigger is unchecked)
How to force the trigger to always been activated. Indeed, the machine could just have a restart, and i dont want (and often i can't be there) to reactivate the trigger.

Regards,
Clem
Sponsor
Forum information
Support
2010-10-21T22:02:31Z
There is no way to "always" have it active. There must be some kind of fall back. However, the right way to do that is to increase retry interval and retry times in the file trigger.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
faulk
  •  faulk
  • No customer Topic Starter
2010-10-22T09:54:46Z
And there is a way to have a task to reactivate the trigger?
ErikC
2010-10-22T10:02:27Z
The only way is to do this is via API.
So you have to make a .net program to do this.

If you have the program, you could run it in a task.

Regards,
Erik
Uses Visualcron since 2006.
faulk
  •  faulk
  • No customer Topic Starter
2010-10-22T10:12:45Z
ErikC
2010-10-22T10:55:13Z
Hi faulk,

I am in a good mood, so here is one solution for you. It is written in C#.
It will enable all triggers of a given job.

Run it like: vcEnableTrigger.exe <JOBNAME>

For more info about API I would ask you to read the manual.

Regards and a good weekend!
Erik

using System;
using System.Collections.Generic;
using System.Text;

using VisualCron;
using VisualCronAPI;

namespace vcEnableTrigger
{
	class Program
	{
		static void Main(string[] args)
		{
			Server s = null;
			Client c = new Client();

			//connection settings
			Connection conn = new Connection();
			conn.UserName = "username";
			conn.PassWord = "password";
			conn.Port = 16444;
			conn.Address = "servername";
			conn.ConnectionType = Connection.ConnectionT.Remote;

			//look for the jobname
			string JobName ="";
			if(args.Length>0)
				JobName = args[0];

			if (JobName != "")
			{
				try
				{
					//connect to the server
					s = c.Connect(conn, true);
				}
				catch (Client.ClientLoginFailedException ex)
				{
					//something went wrong here
					Console.WriteLine(string.Format("\nError:\n{0}", ex.Message));
					return;
				}

				//itterate through all jobs and find matching name
				foreach (JobClass job in s.Jobs.GetAll())
				{
					if (JobName.ToLower() == job.Name.ToLower())
					{
						//match found, display name
						Console.WriteLine(job.Name);
						//itterate trough all triggers from this job
						foreach (TriggerClass trigger in job.Triggers)
						{
							//activate the trigger
							trigger.Active = true;
							Console.WriteLine("  " + trigger.Description);
							s.Jobs.Triggers.Update(job, trigger);
						}
					}
				}

				//close the server connection
				c.Disconnect(s);
			}
			else
			{
				//display help text
				Console.WriteLine("vcEnableTrigger.exe <JOBNAME>");
			}
		}
	}
}

Uses Visualcron since 2006.
Scroll to Top