You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.1 KiB
70 lines
1.1 KiB
//! Job config
|
|
use super::*;
|
|
|
|
/// Target for oneshots
|
|
#[derive(Debug,Eq,PartialEq,Hash)]
|
|
pub enum Target
|
|
{
|
|
/// Fired when daemon starts
|
|
Startup,
|
|
/// Fired when config reloaded
|
|
Reload,
|
|
/// Fired only when user tells it to
|
|
Specific,
|
|
}
|
|
|
|
/// When the job should be ran
|
|
#[derive(Debug, PartialEq,Eq,Hash)]
|
|
pub enum When
|
|
{
|
|
/// Run when a target is reached
|
|
Oneshot(Target),
|
|
/// Run on an interval
|
|
Interval(interval::Time),
|
|
}
|
|
|
|
/// A command for `Job`
|
|
#[derive(Debug, Eq,PartialEq,Hash)]
|
|
pub struct Command
|
|
{
|
|
program: String,
|
|
args: Vec<String>,
|
|
}
|
|
|
|
/// Output for `define-job`
|
|
#[derive(Debug, PartialEq,Eq,Hash)]
|
|
pub struct Job
|
|
{
|
|
name: String,
|
|
when: Vec<When>,
|
|
what: Command,
|
|
}
|
|
|
|
// Global config
|
|
|
|
/// Type of access
|
|
#[derive(Debug, PartialEq,Eq,Hash)]
|
|
pub enum Access
|
|
{
|
|
Allow,
|
|
Deny,
|
|
}
|
|
|
|
/// A permission entry for users
|
|
#[derive(Debug,PartialEq,Eq,Hash)]
|
|
pub enum UserPermAlias {
|
|
Single(String),
|
|
Group(String),
|
|
All,
|
|
}
|
|
|
|
/// Access rule for user
|
|
#[derive(Debug, PartialEq,Eq,Hash)]
|
|
pub struct UserRule
|
|
{
|
|
user: UserPermAlias,
|
|
mode: Access,
|
|
}
|
|
|
|
const DEFAULT_JOB_DIR: &str = "/etc/rori.kron";
|