systemd tool command

	systemd new features: 
		implement the service started in parallel when the system boots. 
		Demand activation process 
		system state snapshot 
		dependency-based service control logic definition of 
		
	core concepts: unit (unit) 
		configuration file identification and configuration, file system contains the main service, listening socket, save a snapshot of the system and other relevant information init 
		file is saved to: 
			/ usr / lib / systemd / system 
			/ RUN / systemd / system 
			/ etc / systemd / system 
	
		Unit type: 
			-service Unit: file extension .service, for defining a service system 
			Target unit: file extension .target, for analog achieve operational level 
			device unit: .device used to define the core recognition device 
			mount unit: .mount definition file system mount point 
			socket unit: .socket, identify the process for inter-socket communication file 
			snapshot unit: management system snapshot 
			swap unit : identifies the swap device 
			automount unit: .automount mount point for the file system 
			path unit: .path definition file system for a file or directory
			 
	key features:
		Based on the activation mechanism of the socket, socket and separate service program 
		based on the activation mechanism of the bus; 
		based device activation mechanism of 
		 activation mechanism path based 
		 system snapshot 
		 backward compatibility sysv init scripts. 
			
	Incompatible: 
		systemctl command fixed, 
		non-started by systemd service, systemctl unable to communicate with 
	management systems and services: 
		CENTIOS 7: Service Unit 
		Note compatible service early script 
		
		command: systemctl the COMMAND name.service 
		
	
	systemctl Start name.service 
	systemctl name.service STOP	 
	systemctl status name.service	 
	systemctl restart name.service	 
	
conditions restarted: systemctl try-restart name.service 

view the current state of service: IS-systemctl the Active name.service 
	
------------- ------------------------------------------------- 
location: Home »system management» systemctl systemctl command process and the job management service management system systemctl command instructions, it is actually a combination of these two command service and chkconfig together. The new directive tasks the old directive
Make a service to start automatically chkconfig --level 3 httpd on systemctl enable httpd.service 
make a service does not start automatically chkconfig --level 3 httpd off systemctl disable httpd.service 
check the service status httpd Status systemctl Status httpd.service Service 
(Service Details ) systemctl is-active httpd.service (display only if Active) 
shows all the services started chkconfig --list systemctl list-units --type = service 
to start a service service httpd start systemctl start httpd.service 
stop a service service httpd stop systemctl stop httpd.service 
	target Units: 
restart a service service httpd restart systemctl restart httpd.service
Show all services: chkconfig --list systemctl list-units --type = service --all 
View all service startup state-Unit-Files List systemctl --type = Service


			unit profile .target 
			run level: 
			0 ==== runlevel0.target poweroff shutdown 
			1 ==== runlevel1.target rescue.target rescue mode 
			2 ===== runlevel2.target multi-user.target 
			3 ==== runlevel3.target multi-user.target = 
			. 4 ==== runlevel4.target multi-user.target 
	# 2. 4. 3 the same level as 
			5 ==== runlevel5.target GUI level graphical.target 
			. 6 ==== runlevel6.target reboot .target 
	
	level switching: 
		the init N ==== systemctl the isolate name.target 
		
		systemctl switched to the isolate # graphical.target graphical interface 
	
			systemctl list-units --type target # Check load level 
------------ -------------------------------------------------- 
basic.target loaded active active Basic System
cryptsetup.target     loaded active active Encrypted Volumes
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 System
network-online.target loaded active active Network is Online
network-pre.target    loaded active active Network (Pre)
network.target        loaded active active Network
paths.target          loaded active active Paths
remote-fs.target      loaded active active Remote File Systems
the Active Slices loaded the Active slices.target 
		systemctl reboot reboot
sockets.target        loaded active active Sockets
Swap the Active loaded the Active swap.target 
sysinit.target the Active loaded the Active System the Initialization 
timers.target the Active loaded the Active Timers 
---------------------------- --------------------------- 
	
	get the default run level: 
	/ etc / inittab systemctl gET-default 
	modify the default level of 
	/ etc / inittab systemctl set- default graphical.target 

	or modify the configuration file 
	/etc/systemd/system/default.target 
	 /usr/lib/systemd/system/multi-user.target. 

	the etc user lib is connected to the file of the soft 
	
	
	switch to rescue mode: 
	systemctl emergemcy 
	
	other commonly used commands 
		systemctl halt shutdown 
		systemctl poweroff shutdown 
		systemctl suspend pending 
		systemctl hiberate snapshot
		systemctl hybrid-sleep 快照并且挂起
		
--------------------------------------------------------
System Commands:
  is-system-running               Check whether system is fully running
  default                         Enter system default mode
  rescue                          Enter system rescue mode
  emergency                       Enter system emergency mode
  halt                            Shut down and halt the system
  poweroff                        Shut down and power-off the system
  reboot [ARG]                    Shut down and reboot the system
  kexec                           Shut down and reboot the system with kexec
  the Request User instance Exit Exit 
  switch-root ROOT [INIT]         Change to a different root file system
  Suspend the Suspend The System 
  Hibernate the Hibernate The System 
  Hybrid and the Hibernate Suspend-SLEEP The System 
----------------------------- --------------------------------------		 
	
	
	systemctl List-view the dependencies httpd.service # dependency 
	
	systemctl reload-or-restart # reload or restart the service 
	
	ban is set to boot from Kai: systemctl mask name.service 
		
	cancel the setting systemctl umask name.service

  

 

Guess you like

Origin www.cnblogs.com/zy09/p/11126514.html