Exemple #1
0
        public virtual void Rotate(DateTime dateTime)
        {
            if (!IsMatch(dateTime))
            {
                return;
            }

            rotateTime = dateTime;

            var root = options.Root;

            if (!Directory.Exists(root))
            {
                root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, options.Root);
                if (!Directory.Exists(root))
                {
                    return;
                }
            }

            var sourceFiles = new List <string>();

            DetectRotateSourceFiles(root, sourceFiles);
            if (sourceFiles.Count == 0)
            {
                return;
            }

            RotateFiles(sourceFiles, ArchiveFile);
            NginxDaemon.Run("-s reopen").WaitForExit();   // reopen
            RotateFiles(sourceFiles, CleanFile);
            if (options.Compress)
            {
                RotateFiles(sourceFiles, CompressFile);
            }
        }
Exemple #2
0
 NginxD(string serviceName)
 {
     ServiceName = serviceName;
     daemon      = new NginxDaemon(this);
 }