如何为Mac OS X创建Windows服务? [英] How to create a Windows service for Mac OS X?

查看:157
本文介绍了如何为Mac OS X创建Windows服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows中,可以创建可以作为服务安装的应用程序.这种类型的应用程序称为Windows服务. Mac OS X上的服务相当于什么?它们是如何实施的以及从何处开始学习?

In Windows it is possible to create an application that can be installed as a service. This type of application is called a Windows Service. What would be the equivalent of services on Mac OS X? How are they implemented and where to start to learn about it?

我想创建一个服务来自动执行任务,并根据需要启动和停止它.

I would like to create a service to execute a task automatically, and starting and stopping it on demand.

推荐答案

您需要与

  • ~/Library/LaunchAgents:由用户提供的每用户代理.

    • ~/Library/LaunchAgents: Per-user agents provided by the user.

    /Library/LaunchAgents:管理员提供的每用户代理.

    /Library/LaunchAgents: Per-user agents provided by the administrator.

    /Library/LaunchDaemons:由 管理员.

    /System/Library/LaunchAgents:Mac OS X提供的每用户代理.

    /System/Library/LaunchAgents: Per-user agents provided by Mac OS X.

    /System/Library/LaunchDaemons:Mac OS提供的系统范围的守护程序 X.

    /System/Library/LaunchDaemons: System-wide daemons provided by Mac OS X.

    守护程序 是一项系统级服务,所有客户端都有一个实例. 代理 是一项基于每个用户运行的服务.

    A daemon is a system-wide service of which there is one instance for all clients. An agent is a service that runs on a per-user basis.

    语法很简单,但很容易弄错.如果

    The syntax is simple but it's easy to get it wrong. The Wikipedia article has a good summary of the options if the man page is not to your liking.

    本质上,您要做的是将实际的命令行工具(您的服务)安装在某个位置,然后创建一个launchd配置plist并将其放置在上述位置之一中.您可以配置plist,以使launchd在启动时或定期运行服务,或响应各种操作(例如文件夹内容的更改)运行服务.

    Essentially, what you do is install your actual command-line tool (your service) somewhere and then create a launchd configuration plist and place it in one of the above locations. You can configure the plist so that launchd runs your service at launch or periodically, or in response to various actions (such as the contents of a folder changing).

    此处.

    这篇关于如何为Mac OS X创建Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆