pub struct LaunchAgent {
pub label: String,
pub program_arguments: Vec<String>,
pub standard_out_path: PathBuf,
pub standard_error_path: PathBuf,
pub keep_alive: bool,
pub run_at_load: bool,
pub process_type: ProcessType,
}Expand description
Launch Agent configuration.
A Launch Agent is a macOS mechanism for automatically starting user-level processes
at login or in response to specific events. Launch Agents are described using plist files,
which are placed in the ~/Library/LaunchAgents directory.
Each agent can be configured to start automatically, restart on failure, redirect output,
and pass arguments to the launched process. Agents are managed using the launchctl utility.
More information:
[https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html](Apple Developer Documentation)
Fields§
§label: String§program_arguments: Vec<String>§standard_out_path: PathBuf§standard_error_path: PathBuf§keep_alive: bool§run_at_load: bool§process_type: ProcessTypeImplementations§
Source§impl LaunchAgent
impl LaunchAgent
Sourcepub fn from_file(label: &str) -> Result<Self, LaunchAgentError>
pub fn from_file(label: &str) -> Result<Self, LaunchAgentError>
Loads a Launch Agent configuration from ~/Library/LaunchAgents by agent label.
Source§impl LaunchAgent
impl LaunchAgent
Sourcepub fn write(&self) -> Result<(), LaunchAgentError>
pub fn write(&self) -> Result<(), LaunchAgentError>
Writes the Launch Agent configuration to the current user’s LaunchAgents directory.
Sourcepub fn remove(&self) -> Result<(), LaunchAgentError>
pub fn remove(&self) -> Result<(), LaunchAgentError>
Removes the Launch Agent configuration from the current user’s LaunchAgents directory.
Trait Implementations§
Source§impl Clone for LaunchAgent
impl Clone for LaunchAgent
Source§fn clone(&self) -> LaunchAgent
fn clone(&self) -> LaunchAgent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for LaunchAgent
impl<'de> Deserialize<'de> for LaunchAgent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl LaunchControllable for LaunchAgent
impl LaunchControllable for LaunchAgent
Source§fn bootstrap(&self) -> LaunchctlResult<()>
fn bootstrap(&self) -> LaunchctlResult<()>
Bootstrap the launch agent.
Source§fn boot_out(&self) -> LaunchctlResult<()>
fn boot_out(&self) -> LaunchctlResult<()>
Boot out the launch agent. It means not only stop, but also deactivate the launch agent.
Source§fn is_running(&self) -> LaunchctlResult<bool>
fn is_running(&self) -> LaunchctlResult<bool>
Check if the launch agent is running.