Navigation Menu

Skip to content

powerman/inferno-contrib-watchdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Provide watchdog command and module for detecting crash of command/pid and executing some action (shutdown -h by default).

Install

Make directory with this app/module available in /opt/powerman/watchdog/.

Install system-wide:

# git clone https://github.com/powerman/inferno-contrib-watchdog.git $INFERNO_ROOT/opt/powerman/watchdog

or in your home directory:

$ git clone https://github.com/powerman/inferno-contrib-watchdog.git $INFERNO_USER_HOME/opt/powerman/watchdog
$ emu
; bind opt /opt

or locally for your project:

$ git clone https://github.com/powerman/inferno-contrib-watchdog.git $YOUR_PROJECT_DIR/opt/powerman/watchdog
$ emu
; cd $YOUR_PROJECT_DIR_INSIDE_EMU
; bind opt /opt

If you want to run commands and read man pages without entering full path to them (like /opt/VENDOR/APP/dis/cmd/NAME) you should also install and use https://github.com/powerman/inferno-opt-setup

Dependencies

Usage

Example

Shutdown emu when pid 1 exit:

; watchdog -p 1

Shutdown emu in 3 seconds:

; watchdog sleep 3

Output "task done" in 3 seconds:

; watchdog=echo task done
; watchdog sleep 3

Restart app if it crashes:

; watchdog=app
; watchdog app

Use as module to monitor background services:

include "opt/powerman/watchdog/module/watchdog.m";

init(nil: ref Draw->Context, argv: list of string)
{
        spawn service();
}

service()
{
        watchdog := load Watchdog Watchdog->PATH;

        sys->pctl(Sys->NEWPGRP, nil);
        exc->setexcmode(exc->NOTIFYLEADER);
        watchdog->me();

        …
}

About

Watchdog for running services in OS Inferno

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published