-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from Gooddbird/mn_coroutine
tinyrpc_generator
- Loading branch information
Showing
10 changed files
with
474 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
FILE_NAME=$1 | ||
PROJECT_NAME=$(basename ${FILE_NAME}) | ||
CURRENT_PATH=$(cd $(dirname $0); pwd) | ||
PROJECT_ROOT_PATH=$(cd $(dirname $0); cd ..; pwd) | ||
PROJECT_BIN_FILE="${CURRENT_PATH}"/"${PROJECT_NAME}" | ||
PROJECT_CONF_FILE="../conf/${PROJECT_NAME}.xml" | ||
|
||
|
||
echo "Run tinyrpc project, name: ${PROJECT_NAME}, path: ${PROJECT_BIN_FILE}" | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "Please input execuable binary file!" | ||
fi | ||
|
||
# check bin file exist | ||
if [ ! -e ${PROJECT_BIN_FILE} ] | ||
then | ||
echo "Run tinyrpc eror, file: ${PROJECT_BIN_FILE} not exist, please check file" | ||
exit -1 | ||
fi | ||
|
||
# check config xml file exist | ||
if [ ! -e ${PROJECT_CONF_FILE} ] | ||
then | ||
echo "Run tinyrpc eror, file: ${PROJECT_CONF_FILE} not exist, please check config file" | ||
exit -1 | ||
fi | ||
|
||
# check bin file execute privilege | ||
if [ ! -x ${PROJECT_BIN_FILE} ] | ||
then | ||
echo "chmod +x : ${PROJECT_BIN_FILE}" | ||
chmod +x ${PROJECT_BIN_FILE} | ||
fi | ||
|
||
sh shutdown.sh ${PROJECT_NAME} | ||
nohup ./${PROJECT_NAME} ${PROJECT_CONF_FILE} & > ${PROJECT_ROOT_PATH}/log/${PROJECT_NAME}.nohup_log | ||
echo "Start tinyrpc server ${PROJECT_CONF_FILE} succ" | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "Please input tinyrpc server name!" | ||
exit -1 | ||
fi | ||
|
||
FILE_NAME=$1 | ||
PROJECT_NAME=$(basename ${FILE_NAME}) | ||
CURRENT_PATH=$(cd $(dirname $0); pwd) | ||
PROJECT_BIN_FILE="${CURRENT_PATH}"/"${PROJECT_NAME}" | ||
PROJECT_CONF_FILE="../conf/${PROJECT_NAME}.xml" | ||
|
||
echo "Shutdown tinyrpc project, name: ${PROJECT_NAME}, path: ${PROJECT_BIN_FILE}" | ||
|
||
# check bin file exist | ||
if [ ! -e ${PROJECT_BIN_FILE} ] | ||
then | ||
echo "Shtdown tinyrpc eror, file: ${PROJECT_BIN_FILE} not exist, please check file" | ||
exit -1 | ||
fi | ||
|
||
|
||
proc_list=`ps -elf | grep "${PROJECT_NAME}" | grep -v 'grep' | grep -v 'shutdown.sh' | awk '{print $4}'` | ||
echo ${proc_list[0]} | ||
|
||
for i in ${proc_list[@]} | ||
do | ||
bin_path=`ls -l /proc/${i}/exe | awk '{print $11}'` | ||
echo ${bin_path} | ||
if [ "$bin_path" = "$PROJECT_BIN_FILE" ] | ||
then | ||
echo "kill this proc: ${i}" | ||
kill -9 ${i} | ||
fi | ||
done | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.