The nosh toolset comprises these commands. See their manual pages for documentation.
The eponymous nosh
is a minimal non-shell script interpreter, for use in run
scripts (and elsewhere) where desired.
Its operation is akin to that of Laurent Bercot's execline
.
The idea of it is to eliminate even the startup cost of the Almquist shell from service scripts (c.f. Debian's switch from the Bourne Again to the Almquist shell to reduce shell overhead in system scripts).
nosh
isn't a shell at all, does no parsing (only lexing), and incorporates most of the package's chain-loading tools as built-ins (to even eliminate the cost of execve
and runtime library setup/teardown).
exec
is, similarly, a simple tool for chain-loading.
General process state:
appendpath
— append a value to the end of a path-style environment variable, handling the separator characters for you
background
— run a child process asynchronously
chdir
— change working directory
chroot
— change root directory
clearenv
— clear the environment, selectively or totally
delegate-control-group-to
— delegate the current control group to an(other) account, preparatory to becoming that user with setuidgid
or similar
envdir
— process a daemontools-style envdir to set/unset environment variables
envuidgid
— set UID and GID environment variable values from the system account database
fdmove
— copy/move file descriptors around
fdredir
— open file descriptors for reading, writing, append, and so forth
find-default-jvm
— find the JAVA_HOME
for the default JVM
find-matching-jvm
— find the JAVA_HOME
for a matching JVM
foreground
— run a child process synchronously, before continuing
hardlimit
— change hard resource limits
local-reaper
— set the local "Grim Reaper" status on/off
machineenv
— initialize "machine" environment variables such as HOSTNAME
, MACHINEID
, and DOMAINNAME
make-private-fs
— mount private filesystems in various places to hide the global filesystems from view
make-read-only-fs
— mount read-only filesystems in various places
move-to-control-group
— change into a given control group, absolute or relative to the current one
oom-kill-protect
— set the protection level against the kernel's Out Of Memory Killer
pipe
— run a child process asynchronously, connected to the current process's standard input or standard output via a pipe
prependpath
— prepend a value to the beginning of a path-style environment variable, handling the separator characters for you
read-conf
— process a BSD rc.conf
style file to set environment variables
set-control-group-knob
— change a knob in the current control group
set-mount-object
— set the state of a mount object, in the process' mount namespace
setenv
— set an environment variable
setlock
— obtain an open file descriptor for a lock file
setpgrp
— become a process group leader, if permitted
setsid
— become a session leader, if permitted
setuidgid-fromenv
— set UIG, GID, and supplementary groups from environment variables
setuidgid
— set UIG, GID, and supplementary groups from the system account database
softlimit
— change soft resource limits
ulimit
— change soft or hard resource limits
umask
— change the umask
unsetenv
— unset an environment variable
unshare
— unhare Linux namespaces
userenv
— initialize "login" environment variables such as HOME
, SHELL
, USER
, and LOGNAME
Construction tools for terminal login services and pseudo-terminal tools:
login-banner
— display an /etc/issue
style banner
login-process
— write a "login"/"getty" entry in the login accounting database for the controlling terminal (Modern BSDs no longer support this notion.)
login-prompt
— wait for a newline from the terminal, serial terminal login style, to prevent unnecessary service churn when login
has a timeout that cannot be turned off
open-controlling-tty
— open the device named by TTY
as the controlling terminal and set the standard file descriptors
pty-get-tty
— open the master side of a new pseudo-terminal and set TTY
to the name of the attached slave side device
pty-run
— perform all I/O beween the master side of a pseudo-terminal and standard input/output, and spawn a child as the slave side
vc-get-tty
— set TTY
to the name of a kernel/user space virtual terminal device, and set TERM
to an appropriate terminal emulator type
vc-reset-tty
— emit, without need for any termcap/terminfo database to be accessible, the control sequences to reset a kernel/user space virtual terminal (Logout causes terminal hangup and console-terminal-emulator
to reset the terminal, making this largely unnecessary with user space virtual terminals.)
Interacting with UCSPI servers:
line-banner
— print the initial greeting that some UCSPI-TCP services do not print for themselves
fifo-listen
— open a listening FIFO
local-datagram-socket-listen
— open a listening AF_LOCAL datagram socket
local-seqpacket-socket-accept
— accept connections on an AF_LOCAL sequential packet socket, with concurrency control
local-seqpacket-socket-listen
— open a listening AF_LOCAL sequantial packet socket
local-stream-socket-accept
— accept connections on an AF_LOCAL stream socket, with concurrency control
local-stream-socket-listen
— open a listening AF_LOCAL stream socket
netlink-datagram-socket-listen
— open a listening AF_NETLINK datagram socket
recordio
— a UCSPI filter that records all I/O traffic to file
tcp-socket-accept
— accept connections on a TCP socket, with concurrency control
tcp-socket-connect
— connect to a TCP server
tcp-socket-listen
— open a listening TCP socket
tcpserver
— open a listening TCP socket and accept connections on it
ucspi-socket-rules-check
— check the peer (i.e. client) end of the open socket against an access control rules database
udp-socket-connect
— connect to a UDP server
udp-socket-listen
— open a listening UDP socket
Others:
monitored-fsck
— invoke fsck
so that its progress information is directed to a monitoring service
Log management:
cyclog
— a tool to run (simple) logging services that write a size-limited, nanosecond timestamped, and automatically-rotated set of log files
klog-read
— a UCSPI server that expects stream input, which it decodes from the old syslog message format and writes to its own log output
syslog-read
— a UCSPI server that expects datagram input, which it decodes from the old syslog message format and writes to its own log output
tai64n
— a Unix-style filter to prepend nanosecond timestamps to each line of its input and send the result to its output
tai64nlocal
— a Unix-style filter to substitute local format local timezone timestamps for nanosecond timestamps in its input and send the result to its output
export-to-rsyslog
— post-process one or more log directories, sending log data to an RSYSLOG server
follow-log-directories
— post-process one or more log directories, writing log data to standard error
User space virtual terminal services and terminal tools:
console-clear
(a.k.a. clear_console
) — clear a terminal's display, and its scroll back buffer if it has one (a replacement for the Bourne Again shell's external command of the same name) that uses (de facto) standard control sequences (supported by xterm, PuTTY, the Linux kernel terminal emulator, and console-terminal-emulator
) rather than kernel-specific virtual terminal mechanisms (Logout causes terminal hangup and console-terminal-emulator
to clear the display buffer, making this largely unnecessary with user space virtual terminals.)
console-convert-kbdmap
— create a full ISO 9995-3 keyboard map from a BSD kbdmap
file
console-fb-realizer
— "realize" a user-space virtual terminal onto a physical "head", i.e a keyboard input event device and a framebuffer display device, with specified fonts and keyboard maps
console-ncurses-realizer
— "realize" a user-space virtual terminal onto another terminal using Wide NCurses
console-multiplexor
— multiplex several user-space virtual terminals into one, using the conventional alt
-plus-function-key hotkeys
console-multiplexor-control
— control multiplexed user-space virtual terminals
console-resize
(a.k.a. resizecons
) — resize a terminal's display using DEC VT control sequences, which can properly pass over remote connections and don't need superuser privileges
console-terminal-emulator
— provide the internal workings of a user-space virtual terminal, compatible with the Linux/FreeBSD/SCO kernel terminal emulators or a DEC VT
Login services:
emergency-login
— a minimal superuser login program that only uses the system account database, suitable for use in emergency mode when there is no remote authentication available, there are no non-root filesystems mounted, and the TTY "secure" flag needs to be ignored
ttylogin-starter
— auto-start ttylogin@
services (on demand on Linux) for kernel virtual terminals
login-update-utmpx
— update the active terminal login database for bootstrap and shutdown
Others:
monitor-fsck-progress
— a UCSPI "accepting" server that expects instances of fsck
to connect to it as clients, and that displays fancy progress information on the console it is attached to
plug-and-play-event-handler
— a UCSPI server to read Plug and Play events and invoke a Plug and Play manager utility, one at a time and in order, for each event
set-dynamic-hostname
— initialize the system hostname
setup-machine-id
— initialize the system machine ID and (BSD) host ID
false
— do nothing, and exit with a failure code
true
— do nothing, and exit with a success code
pause
— do nothing forever, until signalled
system-manager
— the system manager
per-user-manager
— the per-user manager
service-manager
— the service manager
The system-control
utility provides native service control and status that takes account of service orderings and dependencies.
Its subcommands include:
system-control enable
— enable a service to be autostarted at bootstrap system-control disable
— disable a service from being autostarted at bootstrap system-control start
— start a service system-control stop
— stop a service system-control preset
— set the enable/disable state according to native (as well as systemd-compatible) preset information supplied by packages or the system administrator system-control reset
— start/stop a service to make it match its enable/disable state system-control is-active
— determine whether a service is in the "running" state system-control is-loaded
— determine whether a service is loaded by the service manager system-control is-enabled
— determine whether a service is enabled system-control reset
— reset to the autostart status: start an enabled service, stop a disabled one system-control condrestart
— restart a service, if and only if it is currently running system-control hangup
— send session hangup to a service's main process system-control status
— display the status of a service, including the last few lines of its log (if readable via ./log/main/current
) and whether it is enabled system-control show
— output the status of a service, in a machine-readable .INI form system-control show-json
— output the status of a service, in a machine-readable JSON form system-control cat
— display the execution scripts for a service system-control find
— locate a service's service bundle directory system-control unload-when-stopped
— instruct the service manager to unload the service when next it is stopped
For OpenBSD compatibility, it can also be invoked under the name rcctl
, with subcommands:
rcctl get
(a.k.a. system-control print-service-env
) — retrieve environment variables from the service's environment variable template (a daemontools-style envdir in ./service/env/
) rcctl set
(a.k.a. system-control set-service-env
) — set environment variables in the service's environment variable template (a daemontools-style envdir in ./service/env/
) rcctl enable
— enable a service rcctl disable
— disable a service
With the systemd compatibility package, system-control
can also be invoked under the name systemctl
.
Other systemd compatibility commands include:
convert-systemd-units
— convert a systemd target unit, a systemd service unit, or a pair of a service unit and a systemd socket unit, into a native service bundle
The system-control
utility also provides native system control, with the subcommands:
system-control init
— bring the system up in whatever mode the boot loader specified system-control normal
— bring the system up in normal mode (full multi-user login, with all workstation and server services) system-control rescue
— bring the system up in rescue mode (console-only login using the normal login
program, with filesystems mounted and basic system initialized) system-control emergency
— bring the system up in emergency mode (console-only login using emergency-login
, with no initialization) system-control halt
— shutdown all services, unmount all filesystems, and halt the machine system-control reboot
— shutdown all services, unmount all filesystems, and reboot the machine system-control poweroff
— shutdown all services, unmount all filesystems, and power down the machine Other subcommands are:
system-control load-kernel-module
— simple and portable shim for the operating system's kernel module loading tool, used to make portable kmod@
service bundles system-control unload-kernel-module
— simple and portable shim for the operating system's kernel module unloading tool, used to make portable kmod@
service bundles system-control convert-fstab-services
— generate swap@
, dump@
, fsck@
, and mount@
service bundles from the contents of /etc/fstab
system-control write-volume-service-bundles
— generate the swap@
, dump@
, fsck@
, and mount@
service bundles for a single volume system-control nagios-check-service
— a very simple Nagios passive check plug-in that raises critical alerts for non-running enabled services and warnings for disabled services system-control get-mount-where
— find the mount "where" from its "what" system-control get-mount-what
— find the mount "what" from its "where" daemontools-style raw service control and status commands are:
service-control
— the service control utility through which one sends low-level commands to an individual service via its control API in the supervise
directory
daemontools-compatible form: svc -u
service
native form: service-control --down
service
including a whole load of signals not supported by the original daemontools tool
svc -q
/ service-control --quit
svc -1
/ service-control --usr1
svc -2
/ service-control --usr2
svc -w
/ service-control --window
svc -z
/ service-control --suspend
service-dt-scanner
(a.k.a. svscan
) — scan a daemontools-style services directory and command the service manager accordingly
service-status
(a.k.a. svstat
) — service status query tool with human-readable output
service-show
(a.k.a. svshow
) — service status query tool with machine-readable (.INI or JSON) output
service-is-up
(a.k.a. svup
) — test that a service is in the "running" state
service-is-ok
(a.k.a. svok
) — test that a service is loaded and managed by the service manager
service-is-enabled
— test that a service is enabled
There are a whole load of compatibility shims.
System 5 and BSD compatibility tools are complicated by the fact that both traditional toolsets include options that can turn several of the tools into one another, allowing cruel system administrators to give computers self-contradictory and impossible to execute as stated commands such as reboot -p
and halt --reboot
.
The System 5, Debian, BSD, Solaris, and upstart compatibility commands are:
shutdown
— halt/reboot/poweroff, optionally after a period and writing warning messages to logged-on users
reboot
— halt/reboot/poweroff
fastboot
— halt/reboot/poweroff, bypassing shutdown
halt
(a.k.a. haltsys
) — halt/reboot/poweroff
fasthalt
— halt/reboot/poweroff, bypassing shutdown
poweroff
— halt/reboot/poweroff
telinit
— halt/reboot/poweroff or rescue/normal
service
— a limited shim supporting the subset of conventional subcommands that are common to both System 5 and BSD
start
— start a service
stop
— stop a service
status
— display the status of a service
chkconfig
— a limited shim with subcommands
on
— enable a service
off
— disable a service
defaults
— preset a service
update-rc.d
— preset/disable a service, providing a simple Debian workalike that consults native and systemd-compatible preset information rather than Debian-only "policy" mechanisms
invoke-rc.d
— reset/stop a service, providing a simple Debian workalike that simply relies upon the already-determined preset status
initctl
— a simple alias for system-control
; supporting start
, stop
, status
, and suchlike subcommands; and as a bonus adding extra non-upstart things like initctl show
and initctl preset
because of that
svcadm
— a simple alias for system-control
, for Solaris compatibility