Code Monkey home page Code Monkey logo

sdnotify's Introduction

Simple wrapper to help include a statically linked binary into a docker container for use with the systemd watchdog/notify system.

The wrapper only supports three commands:

sdnotify watchdog sdnotify ready sdnotify

The final form sets a status message for the unit.

Note that this still needs support from systemd

[Unit]
Description=showing docker with systemd-notify support

[Service]
Type=notify
NotifyAccess=all
WatchdogSec=10
ExecStart=/usr/local/bin/dockersd %N notify_tester:latest

[Install]
WantedBy=default.target

Where dockersd in this case might look like

#!/bin/bash
# Internally the process must use some form of sd_notify(3) or
# systemd-notify(1) to signal the unit.
SD_NOTIFY_PROXY=/usr/libexec/sdnotify_proxy
SD_SOCK=/tmp/$1.sock

function sdproxy() {
    $SD_NOTIFY_PROXY $SD_SOCK /usr/bin/docker run --volume=$SD_SOCK:$SD_SOCK \
    --env=NOTIFY_SOCKET=$SD_SOCK --env=WATCHDOG_USEC=$WATCHDOG_USEC \
    $@
}

# Invoke the wrapper as 
# $ sdproxy %N dockerargs beyond "run"
sdproxy ${@:2}

All of which depends on sdnotify_proxy which can be found at https://github.com/coreos/sdnotify-proxy

sdnotify's People

Contributors

bcsaller avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.