[−][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 (Non-exhaustive)
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.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.
Implementations
impl Daemon
[src]
pub fn prepare(&self) -> Result<Daemonize, AnyError>
[src]
Prepare for daemonization.
This does the fist (fallible) phase of daemonization and schedules the rest, though the
Daemonize
. This is mostly used through spirit::Pipeline
(see the crate
examples), if used outside of them, prefer the daemonize
.
pub fn daemonize(&self) -> Result<(), AnyError>
[src]
Perform the daemonization according to the setup inside.
This is the routine one would call if using the fragments manually, not through the spirit
management and Pipeline
s.
Trait Implementations
impl Clone for Daemon
[src]
impl Debug for Daemon
[src]
impl Default for Daemon
[src]
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 Eq for Daemon
[src]
impl Fragment for Daemon
[src]
type Driver = OnceDriver<Self>
The default driver to be used by the fragment. Read more
type Resource = Daemonize
The actual product this Fragment
creates.
type Installer = DaemonizeInstaller
The default installer to be used unless a transformation or the user doesn't provide one. Read more
type Seed = ()
The intermediate product if the fragment supports two-stage creation of
Resource
s. If not, it can be set to ()
. Read more
fn make_seed(&self, _: &'static str) -> Result<(), AnyError>
[src]
fn make_resource(
&self,
_: &mut (),
_: &'static str
) -> Result<Daemonize, AnyError>
[src]
&self,
_: &mut (),
_: &'static str
) -> Result<Daemonize, AnyError>
const RUN_BEFORE_CONFIG: bool
[src]
fn create(
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>
[src]
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>
fn init<B>(
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static,
[src]
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static,
impl From<UserDaemon> for Daemon
[src]
fn from(ud: UserDaemon) -> Daemon
[src]
impl PartialEq<Daemon> 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 StructDoc for Daemon
[src]
fn document() -> Documentation
[src]
impl StructuralEq for Daemon
[src]
impl StructuralPartialEq for Daemon
[src]
Auto Trait Implementations
impl RefUnwindSafe for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnwindSafe for Daemon
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,