|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
#!/bin/bash |
|
|
|
|
# chkconfig: 2345 55 25 |
|
|
|
|
# description: MW Cloud Service |
|
|
|
|
# description: go-fastdfs Cloud Service |
|
|
|
|
|
|
|
|
|
### BEGIN INIT INFO |
|
|
|
|
# Provides: bt |
|
|
|
@ -8,8 +8,8 @@ |
|
|
|
|
# Required-Stop: $all |
|
|
|
|
# Default-Start: 2 3 4 5 |
|
|
|
|
# Default-Stop: 0 1 6 |
|
|
|
|
# Short-Description: starts mw |
|
|
|
|
# Description: starts the mw |
|
|
|
|
# Short-Description: starts go-fastdfs |
|
|
|
|
# Description: starts the go-fastdfs |
|
|
|
|
### END INIT INFO |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,10 +18,11 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
|
|
|
|
gf_path={$SERVER_PATH}/go-fastdfs |
|
|
|
|
|
|
|
|
|
gf_start(){ |
|
|
|
|
isStart=`ps -ef| grep -v bash |grep 'go-fastdfs' | grep -v grep|awk '{print $2}'` |
|
|
|
|
isStart=`ps -ef| grep -v python|grep -v bash |grep go-fastdfs | grep -v grep|awk '{print $2}'` |
|
|
|
|
if [ "$isStart" == '' ];then |
|
|
|
|
echo -e "Starting go-fastdfs... \c" |
|
|
|
|
cd $gf_path && chmod +x go-fastdfs && ./go-fastdfs 1> /dev/null 2>/dev/null & |
|
|
|
|
cd $gf_path |
|
|
|
|
nohup ./go-fastdfs > /dev/null 2>&1 & |
|
|
|
|
echo -e "\033[32mdone\033[0m" |
|
|
|
|
else |
|
|
|
|
echo -e "Starting go-fastdfs(pid $(echo $isStart)) already running" |
|
|
|
@ -31,20 +32,21 @@ fi |
|
|
|
|
|
|
|
|
|
gf_stop() |
|
|
|
|
{ |
|
|
|
|
echo -e "Stopping go-fastdfs... \c"; |
|
|
|
|
pids=$(ps aux| grep -v bash | grep 'go-fastdfs'| grep -v grep | awk '{print $2}') |
|
|
|
|
echo -e "Stopping go-fastdfs... \c" |
|
|
|
|
|
|
|
|
|
pids=$(ps -ef| grep -v python |grep -v bash |grep go-fastdfs| grep -v grep | awk '{print $2}') |
|
|
|
|
arr=($pids) |
|
|
|
|
|
|
|
|
|
for p in ${arr[@]} |
|
|
|
|
do |
|
|
|
|
kill -9 $p |
|
|
|
|
kill -9 $p |
|
|
|
|
done |
|
|
|
|
echo -e "\033[32mdone\033[0m" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gf_status() |
|
|
|
|
{ |
|
|
|
|
isStart=$(ps aux | grep -v bash | grep go-fastdfs | grep -v grep | awk '{print $2}') |
|
|
|
|
isStart=$(ps -ef | grep -v python | grep -v bash | grep go-fastdfs | grep -v grep | awk '{print $2}') |
|
|
|
|
if [ "$isStart" != '' ];then |
|
|
|
|
echo -e "\033[32mgo-fastdfs (pid $(echo $isStart)) already running\033[0m" |
|
|
|
|
else |
|
|
|
|