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

bfa ps, bfa top

parent 8c44652e
Branches master
No related tags found
No related merge requests found
......@@ -66,6 +66,40 @@ function pidsfromsigfiles
echo "${pids# }"
}
register_subcommand 'ps' 'psprocs' 'Show processes relating to known .pid files'
function psprocs
{
pids=$(pidsfromsigfiles)
if [ -z "$pids" ]
then
echo "There are no processes of interest." >&2
exit 1
fi
# shellcheck disable=SC2086
ps -p ${pids// /,}
}
register_subcommand 'top' 'topprocs' 'Show relevant processes in top.'
function topprocs
{
pids=$(pidsfromsigfiles)
if [ -z "$pids" ]
then
echo "There are no processes of interest." >&2
exit 1
fi
# shellcheck disable=SC2086
local args pid
args=
# shellcheck disable=SC2086
for pid in $pids
do
args="$args -p $pid"
done
# shellcheck disable=SC2086
exec top $args
}
function sendsig
{
local signal pids
......@@ -79,7 +113,8 @@ function sendsig
# shellcheck disable=SC2086
ps -p ${pids// /,}
echo "Sending ${signal} signal to pid $pids."
kill "$signal" "$pids" || true
# shellcheck disable=SC2086
kill "$signal" $pids || true
}
register_subcommand 'kill' 'killbfastuff' 'Kill BFA background processes (no questions asked).'
......@@ -173,9 +208,11 @@ function importdb
done
geth --networkid "${BFANETWORKID}" --datadir "${BFANODEDIR}" --syncmode "full" --gcmode "archive" import <(
n=1
while gzip -dc "bfa2018-1Mblocksstartingat${n}.block.export.gz" 2>/dev/null
printf -v filename 'bfa2018.blocks.%09d-%09d.export.gz' "$n" "$((n + delta - 1))"
while gzip -dc "$filename" 2>/dev/null
do
n=$(( n + 1000000 ))
n=$((n + delta))
printf -v filename 'bfa2018.blocks.%09d-%09d.export.gz' "$n" "$((n + delta - 1))"
done
true
)
......@@ -336,10 +373,15 @@ function truncatelog
true > "${BFANODEDIR}/log"
}
register_subcommand 'bfageth' 'bfageth' 'Start geth for BFA.'
register_subcommand 'geth' 'bfageth' 'Start geth for BFA.'
function bfageth
{
exec geth --config "${BFANETWORKDIR}/conf.bfa2018.local+full+archive" "$@"
if [ -z "$*" ]
then
echo "You should not run this command without any arguments. Start the background processes with start.sh instead." >&2
exit 1
fi
exec geth --config "${BFANETWORKDIR}/config.localhost+full+archive" "$@"
}
function bfaadmin
......@@ -388,13 +430,13 @@ function main
eval ${commands[$cmd]} "$*"
;;
'admin.sh')
bfaadmin "$*"
bfaadmin "$@"
;;
'bfalog.sh')
bfatail
;;
'bfageth')
bfageth "$*"
bfageth "$@"
exit 1
esac
}
......
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