原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://dgd2010.blog.51cto.com/1539422/1674199
|
1
2
3
4
5
6
7
8
9
|
#!/bin/bash
#chkconfig: 345 86 14
#description: Startup and shutdown script for ChatterServer(Port:$SERVICEPORT))
#SERVICEPORT=29093
#SERVICEPORT=`grep ^port $(pwd)/../conf/constant.properties | awk -F '=' '{print $2}'`
PORTFILE=$(
pwd
)/..
/conf/constant
.properties
#SERVICEPORT=$(cat $PORTFILE | grep ^port | awk -F '=' '{print $2}')
SERVICEPORT=$(
cat
$PORTFILE | dos2unix |
grep
^port)
echo
"SUCCESS: ChatterServer(Port:$SERVICEPORT) is OK"
|
|
1
2
3
4
5
6
7
8
9
10
11
12
|
cat
>.
/portfile
<<eof
port=1080
eof
PIDFILE=.
/portfile
cat
$PIDFILE
#SERVICEPORT=$(grep ^port $PORTFILE | awk -F '=' '{print $2}')
#grep ^port $PORTFILE | awk -F '=' '{print $2}'
# VS
cat
$PIDFILE |
grep
^port |
awk
-F
'='
'{print $2}'
SERVICEPORT=$(
cat
$PIDFILE |
grep
^port |
awk
-F
'='
'{print $2}'
)
echo
$SERVICEPORT
echo
"SUCCESS: ChatterServer(Port:$SERVICEPORT) is OK"
|
|
1
2
3
4
5
|
# NOTE: $(pwd)/../conf/constant.properties file fileformat must be unix NOT dos in shell scripts, or will cause some unknown error
# NOTE: grep is vrey sensitive to dos fileformat or unix fileformat
# apt-get install dos2unix
PORTFILE=$(
pwd
)/..
/conf/constant
.properties
SERVICEPORT=$(
cat
$PORTFILE | dos2unix |
grep
^port |
awk
-F
'='
'{print $2}'
)
|



