|
@@ -6,12 +6,14 @@ show_usage="./install.sh -u(--user) user -n(--name) name -e(--exec) exec"
|
|
|
server_name=""
|
|
|
server_user=""
|
|
|
server_exec=""
|
|
|
+server_path=""
|
|
|
|
|
|
while [ -n "$1" ]; do
|
|
|
case "$1" in
|
|
|
-n|--name ) server_name=$2 ; shift 2;;
|
|
|
-u|--user ) server_user=$2 ; shift 2;;
|
|
|
-e|--exec ) server_exec=$2 ; shift 2;;
|
|
|
+ -d|--chdir ) server_path=$2 ; shift 2;;
|
|
|
* ) echo $show_usage; exit 1 ;;
|
|
|
esac
|
|
|
done
|
|
@@ -29,11 +31,15 @@ elif [[ "" == $server_user ]]; then
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
+test "" -ne $server_path || server_path=`pwd`
|
|
|
+
|
|
|
+
|
|
|
serverd=/etc/init.d/${server_name}d
|
|
|
cp -f server.sh $serverd
|
|
|
|
|
|
sed -i "s!SERVER_NAME!$server_name!" $serverd
|
|
|
sed -i "s!SERVER_USER!$server_user!" $serverd
|
|
|
sed -i "s!SERVER_DAEMON!$server_exec!" $serverd
|
|
|
+sed -i "s!SERVER_PATH!$server_path!" $serverd
|
|
|
|
|
|
echo "Install success!!!"
|