1+ #! /bin/bash
2+
3+ export GOGC=200
4+ # default values
5+ FullImmutabilityThreshold=90000
6+ MinBlocksForBlobRequests=524288
7+ DefaultExtraReserveForBlobRequests=28800
8+
9+ function startChaind() {
10+ workspace=/server/validator
11+
12+ FeynmanHardforkTime=` cat ${workspace} /hardforkTime.txt| grep hardforkTime| awk -F" " ' {print $NF}' `
13+ CancunHardforkTime=` expr ${FeynmanHardforkTime} + 10`
14+ initLog=${workspace} /init.log
15+ rialtoHash=` cat ${initLog} | grep " database=lightchaindata" | awk -F" =" ' {print $NF}' | awk -F' "' ' {print $1}' `
16+
17+ ip=` ifconfig eth0| grep inet| grep -v inet6 | awk ' { print $2 }' `
18+ sed -i -e " s?FileRoot = \"\" ?FileRoot = \" /mnt/efs/validator/${ip} /\" ?g" /server/validator/config.toml
19+ mkdir -p /mnt/efs/validator/${ip}
20+ ${workspace} /bsc --config ${workspace} /config.toml \
21+ --datadir ${workspace} \
22+ --password ${workspace} /password.txt \
23+ --blspassword ${workspace} /password.txt \
24+ --unlock {{validatorAddr}} --miner.etherbase {{validatorAddr}} --rpc.allow-unprotected-txs --allow-insecure-unlock \
25+ --ws --ws.port 8545 --ws.addr ${ip} --http.addr 0.0.0.0 --http.corsdomain " *" \
26+ --metrics --metrics.addr 0.0.0.0 \
27+ --pprof --pprof.port 6061 \
28+ --syncmode snap --state.scheme {{stateScheme}} --db.engine {{dbEngine}} --mine --vote --monitor.maliciousvote \
29+ --cache 10480 --light.serve 50 \
30+ --rialtohash ${rialtoHash} --override.feynman ${FeynmanHardforkTime} --override.feynmanfix ${FeynmanHardforkTime} --override.cancun ${CancunHardforkTime} \
31+ --override.immutabilitythreshold ${FullImmutabilityThreshold} --override.minforblobrequest ${MinBlocksForBlobRequests} --override.defaultextrareserve ${DefaultExtraReserveForBlobRequests} \
32+ >> /mnt/efs/validator/${ip} /bscnode.log 2>&1
33+ }
34+
35+ function stopChaind() {
36+ pid=` ps -ef | grep /server/validator/bsc | grep -v grep | awk ' {print $2}' `
37+ if [ -n " $pid " ]; then
38+ for(( i= 1 ;i<= 4 ;i++ )) ;
39+ do
40+ kill $pid
41+ sleep 5
42+ pid=` ps -ef | grep /server/validator/bsc | grep -v grep | awk ' {print $2}' `
43+ if [ -z " $pid " ]; then
44+ break
45+ elif [ $i -eq 4 ]; then
46+ kill -9 $kid
47+ fi
48+ done
49+ fi
50+ }
51+
52+ CMD=$1
53+
54+ case $CMD in
55+ -start)
56+ echo " start"
57+ startChaind
58+ ;;
59+ -stop)
60+ echo " stop"
61+ stopChaind
62+ ;;
63+ -restart)
64+ stopChaind
65+ sleep 3
66+ startChaind
67+ ;;
68+ * )
69+ echo " Usage: chaind.sh -start | -stop | -restart .Or use systemctl start | stop | restart bsc.service "
70+ ;;
71+ esac
0 commit comments