File tree Expand file tree Collapse file tree 1 file changed +45
-2
lines changed Expand file tree Collapse file tree 1 file changed +45
-2
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- kill -9 ` cat /home/tron/pid.txt`
3- nohup java -jar /home/tron/java-tron/java-tron.jar -p $LOCAL_WITNESS_PRIVATE_KEY --witness -c /home/tron/config.conf > /home/tron/tron-shell.log 2>&1 & echo $! > /home/tron/pid.txt
2+ APP=$1
3+ APP=${APP:- " FullNode" }
4+ START_OPT=` echo ${@: 2} `
5+ JAR_NAME=" $APP .jar"
6+ MAX_STOP_TIME=60
7+
8+ checkpid () {
9+ pid=` ps -ef | grep $JAR_NAME | grep -v grep | awk ' {print $2}' `
10+ return $pid
11+ }
12+
13+ stopService () {
14+ count=1
15+ while [ $count -le $MAX_STOP_TIME ]; do
16+ checkpid
17+ if [ $pid ]; then
18+ kill -15 $pid
19+ sleep 1
20+ else
21+ echo " java-tron stop"
22+ return
23+ fi
24+ count=$[$count +1]
25+ if [ $count -eq $MAX_STOP_TIME ]; then
26+ kill -9 $pid
27+ sleep 1
28+ fi
29+ done
30+ }
31+
32+ startService () {
33+ echo ` date` >> start.log
34+ total=` cat /proc/meminfo | grep MemTotal | awk -F ' ' ' {print $2}' `
35+ xmx=` echo " $total /1024/1024*0.8" | bc | awk -F. ' {print $1"g"}' `
36+ logtime=` date +%Y-%m-%d_%H-%M-%S`
37+ nohup java -Xmx$xmx -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -Xloggc:./gc.log\
38+ -XX:+PrintGCDateStamps -XX:+CMSParallelRemarkEnabled -XX:ReservedCodeCacheSize=256m\
39+ -XX:+CMSScavengeBeforeRemark -jar $JAR_NAME $START_OPT -c config.conf >> start.log 2>&1 &
40+
41+ pid=` ps -ef | grep $JAR_NAME | grep -v grep | awk ' {print $2}' `
42+ echo " start java-tron with pid $pid on $HOSTNAME "
43+ }
44+
45+ stopService
46+ startService
You can’t perform that action at this time.
0 commit comments