Skip to content

Instantly share code, notes, and snippets.

@saii9
Last active July 8, 2018 21:38
Show Gist options
  • Save saii9/b6ea317d4cb0f80df551207b7239fb8e to your computer and use it in GitHub Desktop.
Save saii9/b6ea317d4cb0f80df551207b7239fb8e to your computer and use it in GitHub Desktop.
Some usefull systemd commands
#to check SysV services
chkconfig --list | more
#To check systemd service files
systemctl list-unit-files
systemctl list-units
systemd
___________|___________
| | |
Service Scope Slice
Slices donot contain any process, but provide a blue print for proceses
A Slice may contain a service or scope
A Service is a hierachy group of process that are started via systemd
A Scope heirarchy of process taht can start or create process dyamically
like VM, containers, transient proceess like user sessions
Slice nomenclature
-------------------
name.slice -> name-instance.slice
-.slice is the root slice
Differnet types of Slice
-------------------------
-.slice : the root slice on the top of all the cgroups
system.slice: the default place for all the system services, http, sshd
user.slice : the default place for all user sessions. sshd some systems, graphic display manager
machine.slice: VM and containers
key cgroup commands
--------------------
systemd-cgls
systemd-cgtop
systemd-run
- To run a transient system service
the slice can be run under system or user or new slice under root
unit name slice command
systemd-run --unit=toptest --slice=sai.slice top -b
systemctl
systemctl set-property -> applies the limits to a cgroup
Apply cgroup limits to a permenant process
------------------------------------------
systemctl set-property --runtime name.service MemoryLimit=1200M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment