File tree Expand file tree Collapse file tree 7 files changed +23
-23
lines changed Expand file tree Collapse file tree 7 files changed +23
-23
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ function setout(){
49
49
cd
50
50
mkdir ./ccaa_tmp
51
51
# 创建用户和用户组
52
+ groupadd ccaa
52
53
useradd -M -g ccaa ccaa -s /sbin/nologin
53
54
}
54
55
# 安装Aria2
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ Description=aria2
3
3
After =network.target
4
4
5
5
[Service]
6
- Type =forking
7
6
ExecStart =/usr/bin/sudo -u ccaa /usr/bin/aria2c --conf-path =/etc/ccaa/aria2.conf
8
7
9
8
[Install]
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ Description=ccaa_web
3
3
After =network.target
4
4
5
5
[Service]
6
- Type =forking
7
6
ExecStart =/usr/bin/sudo -u ccaa /usr/sbin/ccaa_web
8
7
9
8
[Install]
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ Description=Filebrowser
3
3
After =network.target
4
4
5
5
[Service]
6
- Type =forking
7
6
ExecStart =/usr/bin/sudo -u ccaa /usr/sbin/filebrowser -c /etc/ccaa/config.json
8
7
9
8
[Install]
Original file line number Diff line number Diff line change 1
- //使用golan实现一个简单的web来支持AriaNg访问
1
+ //Golang实现一个简单的WebServer
2
2
package main
3
3
4
4
import (
5
- "fmt "
6
- "net/http"
7
- "io/ioutil "
5
+ "os "
6
+ "net/http"
7
+ //"fmt "
8
8
)
9
9
10
-
11
- //统计流量
12
- func home_page (w http.ResponseWriter , r * http.Request ) {
13
- //读取AriaNg首页
14
- bytes , err := ioutil .ReadFile ("/etc/ccaa/index.html" )
15
- if err != nil {
16
- fmt .Println ("error : %s" , err )
17
- return
18
- }
19
-
20
- fmt .Fprintln (w , string (bytes ))
21
- }
22
-
23
10
func main () {
24
- //所有页面重定向到首页
25
- http .HandleFunc ("/" , home_page )
11
+ //声明2个变量
12
+ var dir ,port string
13
+ //判断参数的长度
14
+ if len (os .Args ) == 3 {
15
+ dir = os .Args [1 ]
16
+ port = os .Args [2 ]
17
+ } else {
18
+ //如果没有参数,则使用默认
19
+ dir = "/etc/ccaa/AriaNg"
20
+ port = "6080"
21
+ }
26
22
27
- http .ListenAndServe (":6080" , nil )
23
+ panic ( http .ListenAndServe (":" + port , http . FileServer ( http . Dir ( dir ))) )
28
24
}
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ kill -9 $(pgrep 'aria2c')
41
41
kill -9 $( pgrep ' ccaa_web' )
42
42
kill -9 $( pgrep ' filebrowser' )
43
43
kill -9 $( pgrep ' caddy' )
44
+ systemctl disable aria2
45
+ systemctl disable ccaa_web
46
+ systemctl disable filebrowser
44
47
45
48
# 删除文件
46
49
rm -rf /etc/ccaa
@@ -52,6 +55,9 @@ rm -rf aria2-1.*
52
55
rm -rf AriaNg*
53
56
rm -rf /usr/share/man/man1/aria2c.1
54
57
rm -rf /etc/ssl/certs/ca-certificates.crt
58
+ rm -rf /etc/systemd/system/aria2.service
59
+ rm -rf /etc/systemd/system/ccaa_web.service
60
+ rm -rf /etc/systemd/system/filebrowser.service
55
61
56
62
# 删除filebrowser
57
63
rm -rf /usr/sbin/filebrowser
You can’t perform that action at this time.
0 commit comments