初始化
This commit is contained in:
43
回收/Program.cs
Normal file
43
回收/Program.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Timers;
|
||||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
using Common;
|
||||
|
||||
namespace 回收
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static System.Timers.Timer timer;
|
||||
async static Task Main(string[] args)
|
||||
{
|
||||
timer = new System.Timers.Timer();
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Interval = 20000;
|
||||
timer.Start();
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
static void Timer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("go...");
|
||||
string Key = "IISRecycle";
|
||||
int isnew = CSRedisCacheHelper.redis3.Get<int>(Key);
|
||||
if (isnew == 1)
|
||||
{
|
||||
Console.WriteLine("回收了");
|
||||
var cmd = Cli.Wrap("1.cmd")
|
||||
.WithWorkingDirectory("D:\\BLW_Data\\cricsSQL")
|
||||
.ExecuteBufferedAsync();
|
||||
CSRedisCacheHelper.redis3.Set(Key, 0);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user