public static void RequestContainerRestart(IEnvironment environment, string reason) { if (OSDetector.IsOnWindows() && !EnvironmentHelper.IsWindowsContainers()) { throw new NotSupportedException("RequestContainerRestart is only supported on Linux and Windows Containers"); } var restartTriggerPath = Path.Combine(environment.SiteRootPath, CONFIG_DIR_NAME, TRIGGER_FILENAME); FileSystemHelpers.CreateDirectory(Path.GetDirectoryName(restartTriggerPath)); var fileContents = String.Format( FILE_CONTENTS_FORMAT, DateTimeOffset.UtcNow.ToString("o", CultureInfo.InvariantCulture), reason); FileSystemHelpers.WriteAllText(restartTriggerPath, fileContents); }
public static void RequestContainerRestart(IEnvironment environment, string reason, ITracer tracer) { if (OSDetector.IsOnWindows() && !EnvironmentHelper.IsWindowsContainers()) { tracer.Trace("Ignoring FS watcher based recycle request as this is a classic Windows app."); return; } var restartTriggerPath = Path.Combine(environment.SiteRootPath, CONFIG_DIR_NAME, TRIGGER_FILENAME); FileSystemHelpers.CreateDirectory(Path.GetDirectoryName(restartTriggerPath)); var fileContents = String.Format( FILE_CONTENTS_FORMAT, DateTimeOffset.UtcNow.ToString("o", CultureInfo.InvariantCulture), reason); FileSystemHelpers.WriteAllText(restartTriggerPath, fileContents); }