Content #
Default location: /lib/systemd/system,如果要覆盖默认文件,可将自己的文件放在:/etc/systemd/system 目录下。 filename extension describes which type of unit it is.
Type of unit files #
- service
- 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.
- slice Slice units are used when configuring cgroups.
- mount and automount mount point information fro filesystems ahta are controlled by systemd.
- target used during system startup, for grouping units and for providing wellknown synchronization points.
- timer for scheduling jobs that run on a schedule. They replace the old cron system.
- 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.
- swap
state #
systemctl list-unit-files
展示系统中所有已经安装的unit file。
- generated These files live in the /run/systemd/units directory, automatically generated by systemd.
- static Other units will call in these static as dependencies, and you can neight enable or disable these units.
- transient things that are transicent
- 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