solana/snap/hooks/configure

42 lines
1.0 KiB
Plaintext
Raw Normal View History

2018-06-24 10:10:55 -07:00
#!/bin/bash -e
echo Stopping daemons
snapctl stop --disable solana.daemon-drone
snapctl stop --disable solana.daemon-leader
snapctl stop --disable solana.daemon-validator
snapctl stop --disable solana.daemon-oom-monitor
snapctl stop --disable solana.daemon-net-stats
2018-06-24 10:10:55 -07:00
mode="$(snapctl get mode)"
if [[ -z "$mode" ]]; then
exit 0
fi
2018-06-29 07:59:16 -07:00
num_tokens="$(snapctl get num-tokens)"
num_tokens="${num_tokens:+-n $num_tokens}"
setup_args="$(snapctl get setup-args)"
2018-06-24 10:10:55 -07:00
case $mode in
leader+drone)
"$SNAP"/multinode-demo/setup.sh -t leader $num_tokens -p $setup_args
2018-06-24 10:10:55 -07:00
snapctl start --enable solana.daemon-drone
snapctl start --enable solana.daemon-leader
2018-06-24 10:10:55 -07:00
;;
leader)
"$SNAP"/multinode-demo/setup.sh -t leader $num_tokens -p $setup_args
2018-06-24 10:10:55 -07:00
snapctl start --enable solana.daemon-leader
;;
validator)
"$SNAP"/multinode-demo/setup.sh -t validator -p $setup_args
2018-06-24 10:10:55 -07:00
snapctl start --enable solana.daemon-validator
;;
*)
echo "Error: Unknown mode: $mode"
exit 1
;;
esac
snapctl start --enable solana.daemon-oom-monitor
snapctl start --enable solana.daemon-net-stats