Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
af2c7fb7
Commit
af2c7fb7
authored
5 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Fate-sharing process control
parent
c1cd5d6b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/singlestart.sh
+31
-12
31 additions, 12 deletions
bin/singlestart.sh
with
31 additions
and
12 deletions
bin/singlestart.sh
+
31
−
12
View file @
af2c7fb7
...
@@ -9,6 +9,20 @@ bootnodekeyfile=${BFANETWORKDIR}/bootnode/key
...
@@ -9,6 +9,20 @@ bootnodekeyfile=${BFANETWORKDIR}/bootnode/key
# Bail out if anything fails.
# Bail out if anything fails.
trap
"exit 1"
ERR
trap
"exit 1"
ERR
unset
LOGDIR LOGPIPE PIDIDX
declare
-A
PIDIDX
function
reaper
()
{
local
rc
for
pid
in
${
!PIDIDX[*]
}
do
kill
-0
$pid
2>/dev/null
&&
continue
rc
=
wait
$pid
echo
"
${
PIDIDX
[
$pid
]
}
(pid
$pid
) has exited with value
$rc
"
unset
aaa[
$pid
]
done
}
if
[
"
$VIRTUALIZATION
"
=
"DOCKER"
]
if
[
"
$VIRTUALIZATION
"
=
"DOCKER"
]
then
then
...
@@ -47,35 +61,40 @@ then
...
@@ -47,35 +61,40 @@ then
echo
"or: docker exec -i bfanode bfalog.sh"
echo
"or: docker exec -i bfanode bfalog.sh"
fi
fi
unset
LOGDIR LOGPIPE PIDLIST
echo
"*** Setting up logging."
echo
"*** Setting up logging."
# Clean up logging
# Clean up logging
LOGDIR
=
$(
mktemp
-d
)
LOGDIR
=
$(
mktemp
-d
)
trap
"rm -f
${
LOGDIR
}
"
EXIT
trap
"rm -
r
f
${
LOGDIR
}
"
EXIT
LOGPIPE
=
${
LOGDIR
}
/logpipe
LOGPIPE
=
${
LOGDIR
}
/logpipe
mknod
${
LOGPIPE
}
p
mknod
${
LOGPIPE
}
p
${
BFAHOME
}
/bin/log.sh
${
BFANODEDIR
}
/log <
${
LOGPIPE
}
&
${
BFAHOME
}
/bin/log.sh
${
BFANODEDIR
}
/log <
${
LOGPIPE
}
&
PID
LIST
=
"
${
PIDLIST
}
$!
"
PID
IDX[
$!
]=
"log.sh
"
echo
"*** Starting geth."
echo
"*** Starting geth."
geth
--config
${
BFATOML
}
--gcmode
archive
--verbosity
${
BFAVERBOSITY
:-
3
}
--allow-insecure-unlock
>
${
LOGPIPE
}
2>&1 &
geth
--config
${
BFATOML
}
--gcmode
archive
--verbosity
${
BFAVERBOSITY
:-
3
}
--allow-insecure-unlock
>
${
LOGPIPE
}
2>&1 &
PID
LIST
=
"
${
PIDLIST
}
$!
"
PID
IDX[
$!
]=
"geth
"
# bootnode
# bootnode
if
[
-r
"
$bootnodekeyfile
"
]
if
[
-r
"
$bootnodekeyfile
"
]
then
then
echo
"*** Starting bootnode."
echo
"*** Starting bootnode."
bootnode
--nodekey
$bootnodekeyfile
&
bootnode
--nodekey
$bootnodekeyfile
>
${
LOGPIPE
}
2>&1
&
PID
LIST
=
"
${
PIDLIST
}
$!
"
PID
IDX[
$!
]=
"bootnode
"
fi
fi
echo
"*** Starting monitor.js"
echo
"*** Starting monitor.js"
monitor.js &
monitor.js
>
${
LOGPIPE
}
2>&1
&
PID
LIST
=
"
${
PIDLIST
}
$!
"
PID
IDX[
$!
]=
"monitor.js
"
wait
-n
# if one dies
wait
-n
# if one dies
echo
"*** Some process ended, so will shut down other processes too."
>
${
LOGPIPE
}
sleep
2
# give log.sh time to work on the data written, before we kill it.
sleep
2
# give log.sh time to work on the data written, before we kill it.
kill
${
PIDLIST
}
# kill all
echo
"*** Some process ended, so will shut down other processes too."
>
${
LOGPIPE
}
wait
# wait for them all to end
kill
${
!PIDIDX[*]
}
2>/dev/null
||
true
# kill all
# wait for them all to end
max
=
30
while
[
-n
"
${
!PIDIDX[*]
}
"
-a
$max
-gt
0
]
do
sleep
1
max
=
$((
$max
-
1
))
done
kill
-KILL
${
!PIDIDX[*]
}
2>/dev/null
||
true
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment