Extremely basic launchctl wrapper for macOS.
Project description
service
Extremely basic launchctl wrapper for macOS.
Requirements
- macOS 12.x+
- Python 3.10.x, 3.11.x
Installation
pip install py-service
Usage
Usage: service [OPTIONS] COMMAND [ARGS]...
Extremely basic launchctl wrapper for macOS.
Options:
-c, --config TEXT The configuration file to use
--help Show this message and exit.
-v, --verbose Increase verbosity
--version Show the version and exit.
Commands:
disable Disable a service (system domain only).
enable Enable a service (system domain only).
restart Restart a service.
start Start a service.
stop Stop a service.
Services can be referenced by name, file name (with or without extension), or the full path to the file. When referenced by name, the service will be resolved using the defined reverse domains (see Configuration). All the following are valid references:
- baz
- com.foobar.baz
- com.foobar.baz.plist
- /Library/LaunchDaemons/com.foobar.baz
- /Library/LaunchDaemons/com.foobar.baz.plist
Note: Targeting a macOS system service found in the /System/*
path will raise an error and terminate without attempting to modify the service state. These services typically cannot be changed unless SIP is disabled.
Examples
Start a service:
> service start com.bar.foo
Enable and start a service:
> sudo service start --enable com.bar.foo
Stop a service:
> service stop com.bar.foo
Stop and disable a service:
> sudo service stop --disable com.bar.foo
Restart a service:
> service restart com.bar.foo
Enable a service:
> sudo service enable com.bar.foo
Disable a service:
> sudo service disable com.bar.foo
Configuration
Reverse domains can be defined in the file ~/.config/service.toml
. When a service is referenced by name it will be resolved to a file in the current domain using the defined reverse domains. Services cannot be referenced by name only if no reverse domains are defined.
Example configuration:
reverse-domains = [
"com.bar.foo",
"org.bat.baz"
]
License
service is released under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for py_service-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a5d689d6e5fd87d305c6640c68b1d4e75e49d47c65379dfceaeba4b687285a |
|
MD5 | 11b66148c023c5ceacce610191952df7 |
|
BLAKE2b-256 | 335fba145d0177c2d46bc37b3679d56b8a02a1dec09d884eb58b86f5d5efaf12 |