systemd unit files

systemd unit files

Content #

Default location: /lib/systemd/system,如果要覆盖默认文件,可将自己的文件放在:/etc/systemd/system 目录下。 filename extension describes which type of unit it is.

Type of unit files #

  1. service
  2. socket Sockets can either enable communication between different system services or they can automatically wake up a sleeping service when it receives a connection requet.
  3. slice Slice units are used when configuring cgroups.
  4. mount and automount mount point information fro filesystems ahta are controlled by systemd.
  5. target used during system startup, for grouping units and for providing wellknown synchronization points.
  6. timer for scheduling jobs that run on a schedule. They replace the old cron system.
  7. path You can use a path unit to have systemd monitor a certain file or directory to see when it changes. When systemd detects that the file or directory has changed, it will activate the specified service.
  8. swap

state #

systemctl list-unit-files

展示系统中所有已经安装的unit file。

  1. generated These files live in the /run/systemd/units directory, automatically generated by systemd.
  2. static Other units will call in these static as dependencies, and you can neight enable or disable these units.
  3. transient things that are transicent
  4. enabled and disabled units that are in an enabled state will automatically start upon booting the machine, units that are in a disabled state won’t