1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-26 17:37:36 +01:00

cleanup old jobs

This commit is contained in:
Kyle Spearrin 2017-08-17 20:13:10 -04:00
parent c4cc66c391
commit 8021621a3f
5 changed files with 7 additions and 49 deletions

View File

@ -1,38 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Bit.Api.Utilities;
using Microsoft.AspNetCore.Authorization;
using Bit.Core.Services;
namespace Bit.Api.Controllers
{
[Route("jobs")]
[SelfHosted(SelfHostedOnly = true)]
[AllowAnonymous]
public class JobsController : Controller
{
private readonly ILicensingService _licensingService;
private readonly IUserService _userService;
public JobsController(
ILicensingService licensingService,
IUserService userService)
{
_licensingService = licensingService;
_userService = userService;
}
[HttpPost("organization-license")]
public async Task PostOrganizationLicense()
{
await _licensingService.ValidateOrganizationsAsync();
}
[HttpPost("refresh-licenses")]
public Task PostRefreshLicenses()
{
// TODO
return Task.FromResult(0);
}
}
}

View File

@ -53,9 +53,12 @@ namespace Bit.Jobs
{
switch(parameters["j"])
{
case "validate-licenses":
case "validate-organizations":
await _licensingService.ValidateOrganizationsAsync();
break;
case "validate-users":
// TODO
break;
case "refresh-licenses":
// TODO
break;

View File

@ -56,10 +56,7 @@ namespace Bit.Jobs
GlobalSettings globalSettings)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) =>
{
return e.Level >= LogEventLevel.Information;
})
.AddSerilog(env, appLifetime, globalSettings, e => e.Level >= LogEventLevel.Information)
.AddConsole()
.AddDebug();
}

View File

@ -1,3 +1,4 @@
0 * * * * root dotnet /jobs/Jobs.dll -d /jobs -j alive >> /var/log/cron.log 2>&1
0 */6 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-licenses >> /var/log/cron.log 2>&1
0 */6 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-organizations >> /var/log/cron.log 2>&1
# An empty line is required at the end of this file for a valid cron file.

View File

@ -5,9 +5,4 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
</Project>