public static void Peek() { var peekFileName = AzureWebJobShutdownService.GetPeekFileName(); if (File.Exists(peekFileName)) { File.Delete(peekFileName); } File.Create(peekFileName).Dispose(); }
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; }