Quartz.net创建windows服务

时间:2023-03-09 06:26:01
Quartz.net创建windows服务

序言

安装服务

sc create XXService binpath= "XXService.exe"  start= auto
sc description XXService "XX服务"
sc start XXService
pause

卸载服务

sc stop XXService
sc delete XXService
pause
<?xml version="1.0" encoding="UTF-8"?>

<!-- This file contains job definitions in schema version 2.0 format -->

<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">

  <processing-directives>

    <overwrite-existing-data>true</overwrite-existing-data>

  </processing-directives>

  <schedule>

    <!--该作业用于定时更新商品库存-->

    <job>

      <name>UpdateInventoryJob</name>

      <group>Update</group>

      <description>定时更新商品库存</description>

      <job-type>TopshelfAndQuartz.UpdateInventoryJob,TopshelfAndQuartz</job-type>

      <durable>true</durable>

      <recover>false</recover>

    </job>

    <trigger>

      <cron>

        <name>UpdateInventoryTrigger</name>

        <group>Update</group>

        <job-name>UpdateInventoryJob</job-name>

        <job-group>Update</job-group>

        <start-time>2017-12-01T00:00:00+08:00</start-time>

        <cron-expression>0 0/1 * * * ?</cron-expression>

      </cron>

    </trigger>

  </schedule>

</job-scheduling-data>

资料

Quartz.NET 配置文件详解

https://www.cnblogs.com/asxinyu/p/dotnet_Opensource_project_CronNET.html

https://www.cnblogs.com/jsenke/p/5545635.html

https://www.cnblogs.com/qk2014/p/4869675.html