Learn Systemd with me.Http://netkiller.github.io/journal/os.systemd.html Mr.Neo Chen(Chen Jingxian),Netkiller, Bg7nyt
China Guangdong province Shenzhen Khe Sanh Street, Longhua District, civil Administration
518131
+86 13113668890
<[email protected]>
Copyright? Http://netkiller.github.io
Copyright Notice
Reprint please contact the author, please be sure to indicate the original source of the article and the author's information and this statement.
|
Document Source: |
Http://netkiller.github.io |
Http://netkiller.sourceforge.net |
|
|
Scan QR code to enter Netkiller subscription number QQ Group: 128659835 Please specify "reader" |
2015-11-04
Summary my series of documents
Netkiller Architect Codex |
Netkiller Developer Codex |
Netkiller PHP Codex |
Netkiller Python Codex |
Netkiller Testing Codex |
Netkiller Cryptography Codex |
Netkiller Linux Codex |
Netkiller Debian Codex |
Netkiller CentOS Codex |
Netkiller FreeBSD Codex |
Netkiller Shell Codex |
Netkiller Security Codex |
Netkiller Web Codex |
Netkiller Monitoring Codex |
Netkiller Storage Codex |
Netkiller Mail Codex |
Netkiller Docbook Codex |
Netkiller Project Codex |
Netkiller Database Codex |
Netkiller PostgreSQL Codex |
Netkiller MySQL Codex |
Netkiller NoSQL Codex |
Netkiller LDAP Codex |
Netkiller Network Codex |
Netkiller Cisco IOS Codex |
Netkiller H3C Codex |
Netkiller Multimedia Codex |
Netkiller Perl Codex |
Netkiller Amateur Radio Codex |
Netkiller DevOps Codex |
You can use ibook to read the current document
Directory
- 1. What is Systemd
- 2. why-Why do
- 3. When was the SYSTEMD adopted ?
- 4. Those systems use SYSTEMD
- 5. Who developed the system ?
- 6. How to write Systemd scripts
- 6.1. Unit
- 6.2. Service
- 6.3. Install
1. What is SYSTEMD
SYSTEMD is a centralized system and Setup management program (init software) under the Linux computer operating system, including daemons, libraries and applications, developed by Lennart Poettering. Its development goal is to provide a better framework to represent the dependencies between system services, and to implement the parallel startup of the service when the system is initialized, and to reduce the overhead of the shell, and eventually replace the System V and BSD-style init programs commonly used today.
2. why-Why do
Compared to the System V style init used in most distributions, SYSTEMD uses the following new technologies:
Using socket-activated and d-bus-activated services to improve the performance of parallel operation of each dependent service;
The process is tracked using cgroups instead of the process ID, so that the daemons generated even after two fork are not out of systemd control.
3. When was the SYSTEMD adopted?
CentOS 7 starts the system by default using SYSTEMD, for the user is the service is replaced by Systemctl.
4. Those systems use SYSTEMD
Basically, the Linux operating system that derives from Redhat has switched to Systemd,ubuntu and has adopted the SYSTEMD
5. Who developed the system?
Developed by Lennart Poettering
6. How to write Systemd scripts
Here is a SYSTEMD script that launches Tomcat, taking this script as an example I take you into the world of SYSTEMD.
Example 1. /usr/lib/systemd/system/tomcat.service
##################################################### homepage:http://netkiller.github.io# author:netkiller<[ Email protected]># script:https://github.com/oscm/shell# date:2015-11-03###################################### ##############[unit]description=apache Tomcat WEB Application containerafter=network.targetafter=syslog.target[ Service]type=forkinguser=wwwgroup=www#environmentfile=/etc/sysconfig/tomcatexecstartpre= "rm-rf/srv/ apache-tomcat/logs/* "Execstart=/srv/apache-tomcat/bin/startup.sh#execstartpost=execstop=/srv/apache-tomcat/bin /shutdown.sh[install]wantedby=multi-user.target
The script is installed under/usr/lib/systemd/system/tomcat.service
Systemctl Enable Tomcatsystemctl start tomcatsystemctl stop tomcatsystemctl disable tomcat
A symbolic link is created when scripting is enabled
[Email protected] ~]# Ll/etc/systemd/system/multi-user.target.wants/tomcat.service lrwxrwxrwx 1 root root 3 04:06/etc/systemd/system/multi-user.target.wants/tomcat.service-/usr/lib/systemd/system/tomcat.service
6.1. Unit
Description write a text describing the script
After waiting for network ready to run
6.2. Service
Type startup types
User, the Group that runs the Execstart script, is the equivalent of Su-user-c Execstart
Environment environment variable, environmentfile environment variable file
Execstartpre script to run before start, Execstart startup script, Execstartpost script to run after startup
Execstop Stop Script
6.3. Install
Wantedby=multi-user.target installing to multi-user mode
Learn Systemd with me.