Os-signal-lab - Experiments with os signals and process trees

Overview

os-signal-lab

Experiments with os signals and process trees

There's a lot to read about os signals on linux but I want some hard data. Let's investigate:

  • What signals are sent (if any) to processes on system reboot?
  • How does a process send a reboot command to a parent and still exit before being restarted? Assuming we have a restart directive defined.

signals

Here's a mapping between signals and strings that signal.Notify sends on a channel

  • SIGINT: interrupt
  • SIGTERM: terminated
  • SIGHUP: hangup
  • SIGQUIT: quit

We know we can't catch SIGKILL but what about SIGSTOP and companion SIGCONT? Well, I was unable to catch SIGSTOP and it looks like sending SIGSTOP to a process that's connected to a tty in another shell - makes it at least stop reading stdin. Then resumes after SIGCONT. And if I pass SIGINT on stdin while the process is being STOPPED it gets processed after SIGCONT. cool.

Both reboot and systemctl reboot [--no-block] sends SIGHUP which we can catch. The latter is much faster though. Both allow graceful exits.

test

Use the binary to gather data on a linux device. Output includes pid for manual signaling from another shell. After we catch the signal we wait 3s to see if we're allowed a graceful exit.

$ go build
# run and optionally keep a record
$ ./signal-catcher 2>> catcher.log &

license

MIT

Owner
carl-fredrik grimberg
carl-fredrik grimberg
The kitchen part of the Restaurant simulation of the first lab at the Network Programming course

KitchenServerGo This is the kitchen part of the Restaurant simulation of the first lab at the Network Programming course. The dining hall part of the

null 0 Oct 13, 2021
Bonzai - Bonzai! Simple CLI Command Trees in Go

Bonzai! Simple CLI Command Trees in Go Bonzai command trees are unlike anything

Rob Muhlestein 68 Jul 2, 2022
TUI process monitor written in Go

pst This is TUI process monitor written in Go. Features Monitor process's list, info, tree, open files, Kill process Support OS Mac Linux Requirements

skanehira 326 Jun 22, 2022
Business Process eXecution Engine

Problem: creating and maintaining robust business systems Creating a proof-of-concept business system is relatively easy. Happy execution path, no cat

BPXE 32 Jun 2, 2022
Yikes is a cli-application to simplify the process to maintaining a list of tasks to complete.

yikes Yikes is a cli-application to simplify the process to maintaining a list of tasks to complete. It also has commands to help store random notes a

Shreya Paradkar 2 Oct 7, 2021
A tool to enumerate all the command-line arguments used to start a Linux process written in Go.

ranwith A tool to enumerate all the command-line arguments used to start a Linux process written in Go. ranwith uses the Linux /proc directory to obta

Alexis Rodriguez 2 Mar 28, 2022
🧨 Interactive Process Killer CLI made with Go!

proc-manager is an interactive CLI to kill processes made with Go, currently supports Linux, Mac OS X, Solaris, and Windows.

Aykut 17 Jun 27, 2022
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Sensible and fast command-line flag parsing with excellent support for subcommands and positional values. Flags can be at any position. Flaggy has no

Eric Greer 802 Jun 24, 2022
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.

dasel Dasel (short for data-selector) allows you to query and modify data structures using selector strings. Comparable to jq / yq, but supports JSON,

Tom Wright 3.4k Jun 27, 2022
CLI for Shamir's Secret Sharing and AES key generation, encryption, and decryption.

Shush ?? This simple program will help you run Shamir's Secret Sharing algorithm on any file using the split and merge commands.

null 24 Feb 1, 2022
Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go

Sloc Cloc and Code (scc) A tool similar to cloc, sloccount and tokei. For counting physical the lines of code, blank lines, comment lines, and physica

Ben Boyter 3.6k Jul 7, 2022
Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!

Got. Simple and fast concurrent downloader. Installation ❘ CLI Usage ❘ Module Usage ❘ License Comparison Comparison in cloud server: [[email protected]

Mohamed El Bahja 561 Jun 18, 2022
cTRL is a server for remote execution of pending tasks and commands in real time, supporting a queue with continuous thread limiting and throttling.

Документация на русском: https://github.com/eltaline/ctrl/blob/master/README-RUS.md cTRL is a server written in Go language that uses a modified versi

Eltaline 24 Mar 3, 2022
Fast, realtime regex-extraction, and aggregation into common formats such as histograms, numerical summaries, tables, and more!

rare A file scanner/regex extractor and realtime summarizor. Supports various CLI-based graphing and metric formats (histogram, table, etc). Features

Chris LaPointe 155 Jun 30, 2022
Robust, flexible and resource-efficient pipelines using Go and the commandline

Robust, flexible and resource-efficient pipelines using Go and the commandline Project links: Documentation & Main Website | Issue Tracker | Chat Why

SciPipe 930 Jun 29, 2022
Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.

Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.

rclone 33.6k Jul 4, 2022
A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments, comma separated string with urls and an interval.

uptime A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments: -interva

Markus Tenghamn 6 Jan 6, 2022
Command-line tool to load csv and excel (xlsx) files and run sql commands

csv-sql supports loading and saving results as CSV and XLSX files with data processing with SQLite compatible sql commands including joins.

Dhamith Hewamullage 22 May 6, 2022
Slice and dice your TMUX windows and panes

chaakoo Introduction Configuration Using Chaakoo Examples Download License Introduction Chaakoo is a wrapper over TMUX that can create sessions, windo

Pallav Jha 83 May 9, 2022