sysadmin.startupmanager #
startup manager
import freeflowuniverse.crystallib.sysadmin.startupmanager
mut sm:=startupmanager.get()!
sm.start(
name: 'myscreen'
cmd: 'htop'
description: '...'
)!
some basic commands for screen
#screen -ls
#screen -r myscreen
to exit a screen to
ctrl a d
fn get #
fn get() !StartupManager
enum ProcessStatus #
enum ProcessStatus {
unknown
active
inactive
failed
activating
deactivating
}
enum StartupManagerType #
enum StartupManagerType {
screen
zinit
tmux
systemd
}
struct StartupManager #
struct StartupManager {
pub mut:
cat StartupManagerType
}
fn (StartupManager) new #
fn (mut sm StartupManager) new(args zinit.ZProcessNewArgs) !
launch a new process
name string @[required]
cmd string @[required]
test string //command line to test service is running
status ZProcessStatus
pid int
after []string //list of service we depend on
env map[string]string
oneshot bool
start bool = true
restart bool = true // whether the process should be restarted on failure
description string //not used in zinit
fn (StartupManager) start #
fn (mut sm StartupManager) start(name string) !
fn (StartupManager) stop #
fn (mut sm StartupManager) stop(name string) !
fn (StartupManager) restart #
fn (mut sm StartupManager) restart(name string) !
kill the process by name
fn (StartupManager) delete #
fn (mut sm StartupManager) delete(name string) !
remove from the startup manager
fn (StartupManager) status #
fn (mut sm StartupManager) status(name string) !ProcessStatus
remove from the startup manager
fn (StartupManager) running #
fn (mut sm StartupManager) running(name string) !bool
fn (StartupManager) output #
fn (mut sm StartupManager) output(name string) !string
remove from the startup manager
fn (StartupManager) exists #
fn (mut sm StartupManager) exists(name string) !bool
fn (StartupManager) list #
fn (mut sm StartupManager) list() ![]string
list all services as known to the startup manager
struct StartupManagerArgs #
struct StartupManagerArgs {
pub mut:
cat StartupManagerType
}