-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
# `pitchfork stop` | ||
|
||
- **Usage**: `pitchfork stop` | ||
- **Usage**: `pitchfork stop <ID>` | ||
- **Aliases**: `kill` | ||
|
||
Kill a running daemon | ||
Sends a stop signal to a daemon | ||
|
||
## Arguments | ||
|
||
### `<ID>` | ||
|
||
The name of the daemon to stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
use crate::cli::supervisor::kill_or_stop; | ||
use crate::state_file::StateFile; | ||
use crate::Result; | ||
|
||
/// Kill a running daemon | ||
/// Sends a stop signal to a daemon | ||
#[derive(Debug, clap::Args)] | ||
#[clap(visible_alias = "kill", verbatim_doc_comment)] | ||
pub struct Stop {} | ||
pub struct Stop { | ||
/// The name of the daemon to stop | ||
id: String, | ||
} | ||
|
||
impl Stop { | ||
pub async fn run(&self) -> Result<()> { | ||
let pid_file = StateFile::get(); | ||
if let Some(d) = pid_file.daemons.get(&self.id) { | ||
if let Some(pid) = d.pid { | ||
info!("stopping {} with pid {}", self.id, pid); | ||
kill_or_stop(pid, true)?; | ||
return Ok(()); | ||
} | ||
} | ||
warn!("{} is not running", self.id); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters