EBC Exercise 21b systemd

From eLinux.org
Revision as of 15:40, 10 October 2013 by Yoder (Talk | contribs) (Initial Page)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Traditionally user space initialization has been done using init.d, however recently many distributions have been switching to systemd

systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.

Here we'll see how to use systemd as an administration and how to create a simple service.

Administration

systemd

beagle$ systemctl
UNIT                      LOAD   ACTIVE SUB       JOB DESCRIPTION
proc-sys...misc.automount loaded active running       Arbitrary Executable File Formats File System Automount Point
sys-devi...et-eth0.device loaded active plugged       /sys/devices/platform/cpsw.0/net/eth0
sys-devi...et-usb0.device loaded active plugged       /sys/devices/platform/omap/musb-ti81xx/musb-hdrc.0/gadget/net/usb0
sys-devi...cblk0p1.device loaded active plugged       /sys/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0/mmc0:1234/block/mmcblk0/mmcblk0p
sys-devi...cblk0p2.device loaded active plugged       /sys/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0/mmc0:1234/block/mmcblk0/mmcblk0p
sys-devi...mmcblk0.device loaded active plugged       /sys/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0/mmc0:1234/block/mmcblk0
sys-devi...y-ttyO0.device loaded active plugged       /sys/devices/platform/omap/omap_uart.0/tty/ttyO0
sys-devi...y-ttyO1.device loaded active plugged       /sys/devices/platform/omap/omap_uart.1/tty/ttyO1
sys-devi...y-ttyO2.device loaded active plugged       /sys/devices/platform/omap/omap_uart.2/tty/ttyO2
sys-devi...y-ttyO3.device loaded active plugged       /sys/devices/platform/omap/omap_uart.3/tty/ttyO3
sys-devi...y-ttyO4.device loaded active plugged       /sys/devices/platform/omap/omap_uart.4/tty/ttyO4
sys-devi...y-ttyO5.device loaded active plugged       /sys/devices/platform/omap/omap_uart.5/tty/ttyO5
sys-devi...y-ttyS0.device loaded active plugged       /sys/devices/platform/serial8250/tty/ttyS0
sys-devi...y-ttyS1.device loaded active plugged       /sys/devices/platform/serial8250/tty/ttyS1
sys-devi...y-ttyS2.device loaded active plugged       /sys/devices/platform/serial8250/tty/ttyS2
sys-devi...y-ttyS3.device loaded active plugged       /sys/devices/platform/serial8250/tty/ttyS3
sys-devi...et-sit0.device loaded active plugged       /sys/devices/virtual/net/sit0
sys-devi...ty-tty0.device loaded active plugged       /sys/devices/virtual/tty/tty0
sys-devi...ty-tty1.device loaded active plugged       /sys/devices/virtual/tty/tty1
sys-devi...y-tty10.device loaded active plugged       /sys/devices/virtual/tty/tty10
sys-devi...y-tty11.device loaded active plugged       /sys/devices/virtual/tty/tty11
sys-devi...y-tty12.device loaded active plugged       /sys/devices/virtual/tty/tty12
sys-devi...ty-tty2.device loaded active plugged       /sys/devices/virtual/tty/tty2
sys-devi...ty-tty3.device loaded active plugged       /sys/devices/virtual/tty/tty3
sys-devi...ty-tty4.device loaded active plugged       /sys/devices/virtual/tty/tty4
sys-devi...ty-tty5.device loaded active plugged       /sys/devices/virtual/tty/tty5
sys-devi...ty-tty6.device loaded active plugged       /sys/devices/virtual/tty/tty6
sys-devi...ty-tty7.device loaded active plugged       /sys/devices/virtual/tty/tty7
sys-devi...ty-tty8.device loaded active plugged       /sys/devices/virtual/tty/tty8
sys-devi...ty-tty9.device loaded active plugged       /sys/devices/virtual/tty/tty9
-.mount                   loaded active mounted       /
dev-mqueue.mount          loaded active mounted       POSIX Message Queue File System
etc-machine\x2did.mount   loaded active mounted       /etc/machine-id
proc-sys...fmt_misc.mount loaded active mounted       Arbitrary Executable File Formats File System
sys-kernel-debug.mount    loaded active mounted       Debug File System
tmp.mount                 loaded active mounted       Temporary Directory
systemd-...d-console.path loaded active waiting       Dispatch Password Requests to Console Directory Watch
systemd-...word-wall.path loaded active waiting       Forward Password Requests to Wall Directory Watch
avahi-daemon.service      loaded active running       Avahi mDNS/DNS-SD Stack
bone101.service           loaded active running       Beaglebone 101 presentation
cape.service              loaded active exited        Beaglebone cape support
cloud9.service            loaded active running       Cloud9 IDE
connman.service           loaded active running       Connection service
console-...-start.service loaded active exited        Console System Startup Logging
crond.service             loaded active running       Periodic Command Scheduler
dbus.service              loaded active running       D-Bus System Message Bus
dropbear...:59238.service loaded active running       SSH Per-Connection Server
gateone.service           loaded active running       GateOne daemon
gdm.service               loaded active running       Gnome Display Manager
getty@tty1.service        loaded active running       Getty on tty1
leds.service              loaded active exited        Angstrom LED config
network-...t-init.service loaded active exited        Start USB Ethernet gadget
pvr-init.service          loaded active exited        pvr-init.service
remount-rootfs.service    loaded active exited        Remount Root FS
serial-g...@ttyO0.service loaded active running       Serial Getty on ttyO0
systemd-journald.service  loaded active running       Journal Service
systemd-logind.service    loaded active running       Login Service
systemd-...s-load.service loaded active exited        Load Kernel Modules
systemd-...pi-vfs.service loaded active exited        Remount API VFS
systemd-sysctl.service    loaded active exited        Apply Kernel Variables
systemd-...-setup.service loaded active exited        Recreate Volatile Files and Directories
systemd-...ssions.service loaded active exited        Permit User Sessions
timestamp.service         loaded active exited        Timestamping service
udev-trigger.service      loaded active exited        udev Coldplug all Devices
udev.service              loaded active running       udev Kernel Device Manager
udhcpd.service            loaded active running       DHCP server for USB0 network gadget
xinetd.service            loaded active exited        xinetd.service
avahi-daemon.socket       loaded active listening     Avahi mDNS/DNS-SD Stack Activation Socket
dbus.socket               loaded active running       D-Bus System Message Bus Socket
dropbear.socket           loaded active listening     dropbear.socket
systemd-initctl.socket    loaded active listening     /dev/initctl Compatibility Named Pipe
systemd-journald.socket   loaded active running       Journal Socket
systemd-shutdownd.socket  loaded active listening     Delayed Shutdown Socket
udev-control.socket       loaded active listening     udev Control Socket
udev-kernel.socket        loaded active running       udev Kernel Socket
basic.target              loaded active active        Basic System
getty.target              loaded active active        Login Prompts
graphical.target          loaded active active        Graphical Interface
local-fs-pre.target       loaded active active        Local File Systems (Pre)
local-fs.target           loaded active active        Local File Systems
multi-user.target         loaded active active        Multi-User
remote-fs.target          loaded active active        Remote File Systems
sockets.target            loaded active active        Sockets
swap.target               loaded active active        Swap
sysinit.target            loaded active active        System Initialization
systemd-...es-clean.timer loaded active waiting       Daily Cleanup of Temporary Directories

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
JOB    = Pending job for the unit.

86 units listed. Pass --all to see inactive units, too.




thumb‎ Embedded Linux Class by Mark A. Yoder