Example #1
0
        public static void Peek()
        {
            var peekFileName = AzureWebJobShutdownService.GetPeekFileName();

            if (File.Exists(peekFileName))
            {
                File.Delete(peekFileName);
            }

            File.Create(peekFileName).Dispose();
        }
Example #2
0
        public AzureWebJobShutdownService()
        {
            // Get the shutdown file path from the environment
            shutdownFile = AzureWebJobShutdownService.GetShutdownFileName();

            // get the peek file
            peekFile = AzureWebJobShutdownService.GetPeekFileName();

            // Setup a file system watcher on that file's directory to know when the file is created
            fileSystemWatcher                       = new FileSystemWatcher(Path.GetDirectoryName(shutdownFile));
            fileSystemWatcher.Created              += OnChanged;
            fileSystemWatcher.Changed              += OnChanged;
            fileSystemWatcher.NotifyFilter          = NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.LastWrite;
            fileSystemWatcher.IncludeSubdirectories = false;
            fileSystemWatcher.EnableRaisingEvents   = true;
        }