private static DirectoryInfo GetDirectoryToWatch()
        {
            string str = AzureWebJobShutdownHandler.ShutdownFile();

            if (string.IsNullOrWhiteSpace(str))
            {
                throw new InvalidOperationException(string.Format("Environment variable {0} is null or empty.", "WEBJOBS_SHUTDOWN_FILE"));
            }
            return(new DirectoryInfo(Path.GetDirectoryName(str) ?? string.Empty));
        }
 public AzureWebJobShutdownHandler() : base(AzureWebJobShutdownHandler.GetDirectoryToWatch())
 {
 }
 public static bool IsRunningOnAzure()
 {
     return(!string.IsNullOrEmpty(AzureWebJobShutdownHandler.ShutdownFile()));
 }