Skip to content
Snippets Groups Projects
Commit 047c308e authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

start.sh mas consistente en hacer archivos .pid

parent 4591b793
No related branches found
No related tags found
No related merge requests found
......@@ -55,9 +55,15 @@ then
runasownerof ${BFAHOME} git pull
exec $0 wealreadypulled
else
aptinstall libclass-accessor-perl
# make sure bfa is in group sudo
id bfa | grep -q sudo || runasownerof / adduser bfa sudo
aptinstall libclass-accessor-perl
# rebuild installed modules
runasownerof ${BFAHOME} npm rebuild
# install new ones (if any)
runasownerof ${BFAHOME} npm install
# delete stale pid files
runasownerof ${BFAHOME} find ${BFAHOME} -name '*.pid' -delete
set +x
echo "*** Now would be a good time to restart the server."
fi
......@@ -26,7 +26,7 @@ function startbootnode
{
local ERRTEXT="bootnode section failed"
local keyfile=${BFANETWORKDIR}/bootnode/key
local pidfile=${BFANETWORKDIR}/bootnode/bootnode.pid
local pidfile=${BFANETWORKDIR}/bootnode.pid
which bootnode >/dev/null 2>&1 || return 0
test -r $keyfile || return 0
(
......@@ -34,6 +34,7 @@ function startbootnode
echo "A bootnode is already running."
false
) || exit
echo ${BASHPID} > ${BFANODEDIR}/start-bootnode-loop.pid
if [ -t 1 ]
then
echo Starting bootnode.
......@@ -65,10 +66,15 @@ function startmonitor
echo "A monitor is already running."
false
) || exit
echo ${BASHPID} > ${BFANODEDIR}/start-monitor-loop.pid
(
monitor.js &
echo $! > $pidfile
wait
while :
do
monitor.js &
echo $! > $pidfile
wait
sleep 10
done
) 2>&1 | ${BFAHOME}/bin/log.sh ${BFANODEDIR}/log &
) 9>> $pidfile
}
......@@ -117,6 +123,7 @@ function startgeth
{
# Start the node.
local ERRTEXT="geth section failed"
local pidfile=${BFANETWORKDIR}/geth.pid
which geth >/dev/null 2>&1 || return 0
#
(
......@@ -124,7 +131,7 @@ function startgeth
echo "A geth is already running."
false
) || exit 1
echo ${BASHPID} > ${BFANODEDIR}/start-loop.pid
echo ${BASHPID} > ${BFANODEDIR}/start-geth-loop.pid
if [ -t 1 ]
then
echo Starting geth
......@@ -195,12 +202,12 @@ function startgeth
--rpccorsdomain \* \
--bootnodes "${bootnodes}" &
set +x
echo $! > ${BFANODEDIR}/geth.pid
echo $! > $pidfile
rv=0
wait -n || rv=$?
sleep 60
done 2>&1 | ${BFAHOME}/bin/log.sh ${BFANODEDIR}/log &
) 9>> ${BFANODEDIR}/start-loop.pid
) 9>> $pidfile
}
startgeth
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment