Skip to content

Commit

Permalink
dccaa
Browse files Browse the repository at this point in the history
  • Loading branch information
helloxz committed Apr 30, 2020
1 parent bee168a commit cd89113
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions dccaa
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
##### CCAA管理脚本 #####
##### Author:xiaoz.me #####
##### Update:2020-04-30 #####

#导入环境变量
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')

#设置aria2密码
function pass(){
sed -i "s/rpc-secret=/rpc-secret=$1/g" /etc/ccaa/aria2.conf
}

#启动ccaa
function ccaa_start(){
nohup aria2c --conf-path=/etc/ccaa/aria2.conf > /var/log/aria2.log 2>&1 &
nohup /usr/sbin/ccaa_web > /var/log/ccaa_web.log 2>&1 &
nohup filebrowser -c /etc/ccaa/config.json > /var/log/fbrun.log 2>&1 &
exit
}

case $1 in
'start')
ccaa_start
;;
'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}
ccaa_start
;;
'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 ''
;;
'pass')
pass $2
;;
*)
echo '参数错误!'
exit
;;
esac

0 comments on commit cd89113

Please sign in to comment.