forked from helloxz/ccaa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathccaa
61 lines (57 loc) · 1.58 KB
/
ccaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
##### CCAA管理脚本 #####
##### Author:xiaoz.me #####
##### Update:2020-02-27 #####
#导入环境变量
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin
export PATH
aria2pid=$(pgrep 'aria2c')
ccaa_web_pid=$(pgrep 'ccaa_web')
filebrowser_pid=$(pgrep 'filebrowser')
#如果变量不存在
if [ ! $1 ]
then
bash <(curl -Lsk https://raw.githubusercontent.com/helloxz/ccaa/master/ccaa.sh)
exit
fi
case $1 in
'start')
nohup sudo -u ccaa aria2c --conf-path=/etc/ccaa/aria2.conf > /var/log/aria2.log 2>&1 &
nohup sudo -u ccaa /usr/sbin/ccaa_web > /var/log/ccaa_web.log 2>&1 &
nohup sudo -u ccaa filebrowser -c /etc/ccaa/config.json > /var/log/fbrun.log 2>&1 &
exit
;;
'stop')
kill -9 ${aria2pid}
kill -9 ${ccaa_web_pid}
kill -9 ${filebrowser_pid}
;;
'restart')
kill -9 ${aria2pid}
kill -9 ${ccaa_web_pid}
kill -9 ${filebrowser_pid}
nohup sudo -u ccaa aria2c --conf-path=/etc/ccaa/aria2.conf > /var/log/aria2.log 2>&1 &
nohup sudo -u ccaa /usr/sbin/ccaa_web > /var/log/ccaa_web.log 2>&1 &
nohup sudo -u ccaa filebrowser -c /etc/ccaa/config.json > /var/log/fbrun.log 2>&1 &
exit;
;;
'status')
if [ "$aria2pid" == "" ]
then
echo "Not running!"
else
echo '-----------------------------------------------'
echo "Aria2 is running,pid is ${aria2pid}."
echo "AriaNg is running,pid is ${ccaa_web_pid}."
echo "Filebrowser is running,pid is ${filebrowser_pid}."
echo '-----------------------------------------------'
fi
;;
'-v')
cat /etc/ccaa/version.txt && echo ''
;;
*)
echo '参数错误!'
exit
;;
esac