Search code examples
mysqlbatch-filecmdserverexe

Routing a exe File to have a backup target when servers fail


I was wondering what solution is there to give a shortcut to a server, basically an exe, More that 1 target path to basically have the same application on 2 servers so that when one server fails, that the exe goes to the other target path and find the exact same application exe that the shortcut points to. Any solutions would be highly appreciated. Thanx


Solution

  • The answer gave me a guideline to what worked in my situation and i came up with a c# application ran from the local C: drive:

            string Directory1 = @"\\sqlsvr01\Releases\Filename";
            string Directory2 = @"\\sqlsvr02\Releases\filename";
    
            string server1 = @"\\sqlsvr01\Releases\Filename\setup.exe";
            string server2 = @"\\sqlsvr02\Releases\Filename\setup.exe";
    
    
            //look for the file on sqlsvr01 - main publish folder
            if (Directory.Exists(Directory1))
            {
                Process.Start(server1);
                Console.WriteLine("SQLSVR01 reached");
                Console.WriteLine("Executing setup.exe from SQLSVR01");
                Console.ReadLine();
    
                
    
    
            }//if the folders are not found in sqlsvr01 - look for the file on 
              //sqlsvr02 - secondary publish folder
            else if (Directory.Exists(Directory2))
            {
                Process.Start(server2);
                Console.WriteLine("sqlsvr02 reached");
                Console.WriteLine("Executing setup.exe from sqlsvr02");
                Console.ReadLine();
    
               
            }
            else
            {
                Console.WriteLine("None accessible");
                
            }