[−][src]Struct spirit_daemonize::Daemon
A configuration fragment for configuration of daemonization.
This describes how to go into background with some details.
The fields can be manipulated by the user of this crate. However, it is not possible to create
the struct manually. This is on purpose, some future versions might add more fields. If you
want to create one, use Daemon::default
and modify certain fields as needed.
Examples
let mut daemon = Daemon::default(); daemon.workdir = Some("/".into());
See also
If you want to daemonize, but not to switch users (or allow switching users), either because
the daemon needs to keep root privileges or because it is expected to be already started as
ordinary user, use the UserDaemon
instead.
Fields
user: SecId
The user to drop privileges to.
The user is not changed if not provided.
group: SecId
The group to drop privileges to.
The group is not changed if not provided.
pid_file: Option<PathBuf>
Where to store a PID file.
If not set, no PID file is created.
workdir: Option<PathBuf>
Switch to this working directory at startup.
If not set, working directory is not switched.
daemonize: bool
Enable the daemonization.
Even if this is false, some activity (changing users, setting PID file, etc) is still done, but it doesn't go to background.
Methods
impl Daemon
[src]
pub fn daemonize(&self) -> Result<(), Error>
[src]
Goes into background according to the configuration.
This does the actual work of daemonization. This can be used manually.
pub fn extension<E, F>(extractor: F) -> impl Extension<E> where
E: Extensible<Ok = E>,
F: Fn(&E::Config, &E::Opts) -> Self + Send + 'static,
[src]
E: Extensible<Ok = E>,
F: Fn(&E::Config, &E::Opts) -> Self + Send + 'static,
An extension that can be plugged into the Spirit
.
See the crate documentation.
Trait Implementations
impl Eq for Daemon
[src]
impl PartialEq<Daemon> for Daemon
[src]
impl Clone for Daemon
[src]
fn clone(&self) -> Daemon
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Daemon
[src]
impl From<UserDaemon> for Daemon
[src]
fn from(ud: UserDaemon) -> Daemon
[src]
impl Debug for Daemon
[src]
impl Serialize for Daemon
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Daemon
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl StructDoc for Daemon
[src]
fn document() -> Documentation
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,