File tree 3 files changed +48
-0
lines changed
3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,30 @@ hosts 文件在每个系统的位置不一,详情如下:
133
133
134
134
### 2.3 一行命令 (适用于类 Unix 系统)
135
135
136
+ #### 使用 Systemd 管理的 Linux
137
+
138
+ <details >
139
+ <summary ><b >Linux 发行版中 systemd 软件包状态</b ></summary >
140
+
141
+ [ ![ Packaging status] ( https://repology.org/badge/vertical-allrepos/systemd.svg )] ( https://repology.org/project/systemd/versions )
142
+
143
+ </details >
144
+
145
+ ``` bash
146
+ cd GitHub520
147
+ sudo install -Dm0644 update-github520-hosts* -t /usr/lib/systemd/system/
148
+ sudo systemctl enable --now update-github520-hosts.timer
149
+ sudo systemctl start update-github520-hosts.service
150
+ sudo systemctl status update-github520-hosts.service
151
+ cat /etc/hosts
152
+ ```
153
+
154
+ - Arch Linux: [ AUR github520-git] ( https://aur.archlinux.org/packages/github520-git )
155
+
156
+ ``` bash
157
+ yay -Syu github520
158
+ ```
159
+
136
160
#### GNU(Ubuntu/CentOS/Fedora)
137
161
138
162
` sudo sh -c 'sed -i "/# GitHub520 Host Start/Q" /etc/hosts && curl https://raw.hellogithub.com/hosts >> /etc/hosts' `
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =Update GitHub520 Hosts File
3
+ After =network.target
4
+
5
+ [Service]
6
+ User =root
7
+ PermissionsStartOnly =true
8
+ ExecStart =/bin/bash -c 'sed -i "/# GitHub520 Host Start/Q" /etc/hosts && { wget -O - https://raw.hellogithub.com/hosts || wget -O - https://raw.githubusercontent.com/521xueweihan/GitHub520/main/hosts; } >> /etc/hosts'
9
+ ExecStop =/bin/bash -c 'sed -i "/# GitHub520 Host Start/,/# GitHub520 Host End/d" /etc/hosts'
10
+ Restart =on-failure
11
+ RestartSec =30
12
+ StartLimitInterval =3min
13
+
14
+ [Install]
15
+ WantedBy =default.target
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description=Update GitHub520 Hosts File Timer
3
+
4
+ [Timer]
5
+ OnCalendar=*-*-* *:0/1:00
6
+ Persistent=true
7
+
8
+ [Install]
9
+ WantedBy=timers.target
You can’t perform that action at this time.
0 commit comments