Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/go-fastdfs/init.d/go-fastdfs.tpl

70 lines
1.5 KiB

6 years ago
#!/bin/bash
# chkconfig: 2345 55 25
# description: MW Cloud Service
### BEGIN INIT INFO
# Provides: bt
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts mw
# Description: starts the mw
### END INIT INFO
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}'`
6 years ago
if [ "$isStart" == '' ];then
echo -e "Starting go-fastdfs... \c"
cd $gf_path && chmod +x go-fastdfs && ./go-fastdfs 1> /dev/null 2>/dev/null &
echo -e "\033[32mdone\033[0m"
else
echo -e "Starting go-fastdfs(pid $(echo $isStart)) already running"
fi
}
gf_stop()
{
echo -e "Stopping go-fastdfs... \c";
pids=$(ps aux| grep -v bash | grep 'go-fastdfs'| grep -v grep | awk '{print $2}')
6 years ago
arr=($pids)
for p in ${arr[@]}
do
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}')
6 years ago
if [ "$isStart" != '' ];then
echo -e "\033[32mgo-fastdfs (pid $(echo $isStart)) already running\033[0m"
else
echo -e "\033[31mgo-fastdfs not running\033[0m"
fi
}
gf_reload()
{
gf_stop
gf_start
}
case "$1" in
'start') gf_start;;
'stop') gf_stop;;
'reload') gf_reload;;
'status') gf_status;;
'restart')
gf_stop
gf_start;;
esac