GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - victorenator/node-sd-daemon: Bindings for libsystemd-daemon

BranchesTags
Open more actions menu

Latest commit

 

History

53 Commits
53 Commits

Folders and files

NameName
Last commit message
Last commit date
debian
debian
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
README.md
README.md
 
 
binding.gyp
binding.gyp
 
 
index.js
index.js
 
 
package.json
package.json
 
 

Repository files navigation

Bindings for libsystemd-daemon

Dependencies

  • build-essential
  • pkg-config
  • libsystemd-dev or libsystemd-daemon-dev

Install

npm install sd-daemon

Debian

sudo apt-get install devscripts
sudo mk-build-deps -ir
debuild
sudo dpkg -i ../node-sd-daemon_*.deb

CentOS

sudo yum install systemd-devel

Test

Watchdog

test.service:

...
[Service]
WatchdogSec=10s

test.js:

...
sd.startWatchdogPing();
systemctl --user link "$PWD/test/test.service"
systemctl --user start test.service

curl localhost:8089
systemctl --user status test.service
curl localhost:8089/block

...
systemctl --user status test.service

systemctl --user stop test.service
systemctl --user disable test.service

Socket Activation

test-socket.socket:

...
[Socket]
ListenStream=8088

test-socket.service:

...
[Service]
ExecStart=/usr/bin/nodejs test-socket.js
NonBlocking=yes

test-socket.js:

var listeners = sd.listeners();
if (listeners.length) {
    server.listen(listeners[0]);
}
systemctl --user link "$PWD/test/test-socket.socket" "$PWD/test/test-socket.service"
systemctl --user start test-socket.socket

curl localhost:8088
systemctl --user status test-socket.service
...

systemctl --user stop test-socket.socket test-socket.service
systemctl --user disable test-socket.socket

Cluster (two instances)

[email protected]

[Service]
ExecStart=/usr/bin/nodejs test-s3.js %i
NonBlocking=yes
Sockets=test-s3.socket

test-s3.socket:

[Socket]
ListenStream=8087
Service[email protected]
Service[email protected]
$ systemctl --user link "$PWD/test/[email protected]" "$PWD/test/test-s3.socket"
$ systemctl --user start [email protected] [email protected]

$ systemctl --user list-units --all test-s3*
 UNIT              LOAD   ACTIVE SUB     DESCRIPTION
[email protected] loaded active running Test-S3 Service
[email protected] loaded active running Test-S3 Service
test-s3.socket    loaded active running Test S3 Socket

$ systemctl --user list-sockets test-s3*
LISTEN    UNIT           ACTIVATES
[::]:8087 test-s3.socket [email protected], [email protected]

$ ss -tlp
LISTEN 0 128  :::8087 :::*  users:(("nodejs",pid=...,fd=3),("nodejs",pid=...,fd=3),("systemd",pid=...,fd=...))

$ curl localhost:8087
Hello 2

$ curl localhost:8087
Hello 1

$ curl localhost:8087
Hello 1

$ curl localhost:8087
Hello 2

$ systemctl --user stop [email protected] [email protected] test-s3.socket
$ systemctl --user disable [email protected] test-s3.socket

About

Bindings for libsystemd-daemon

Resources

Readme
Activity

Stars

18 stars

Watchers

5 watching

Forks

17 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.