2020-06-15 15:35:18 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2020-06-26 10:56:00 +01:00
|
|
|
# add default value to joinin config if needed
|
|
|
|
|
if ! grep -Eq "^YGwallet=" /home/joinmarket/joinin.conf; then
|
|
|
|
|
echo "YGwallet=nil" >> /home/joinmarket/joinin.conf
|
|
|
|
|
fi
|
|
|
|
|
|
2020-06-15 15:35:18 +01:00
|
|
|
# YG menu options
|
2020-09-30 13:58:32 +01:00
|
|
|
source /home/joinmarket/_functions.sh
|
2020-06-15 15:35:18 +01:00
|
|
|
source /home/joinmarket/joinin.conf
|
|
|
|
|
|
|
|
|
|
# BASIC MENU INFO
|
2020-10-14 09:39:28 +01:00
|
|
|
HEIGHT=13
|
2020-06-15 15:35:18 +01:00
|
|
|
WIDTH=52
|
|
|
|
|
CHOICE_HEIGHT=20
|
2020-10-14 09:39:28 +01:00
|
|
|
TITLE="Yield Generator options"
|
|
|
|
|
MENU=""
|
2020-06-15 15:35:18 +01:00
|
|
|
OPTIONS=()
|
|
|
|
|
BACKTITLE="JoininBox GUI"
|
|
|
|
|
|
|
|
|
|
# Basic Options
|
|
|
|
|
OPTIONS+=(\
|
|
|
|
|
MAKER "Run the Yield Generator" \
|
|
|
|
|
YGCONF "Configure the Yield Generator" \
|
2020-06-18 14:08:25 +01:00
|
|
|
YGLIST "List the past YG activity" \
|
2020-06-20 13:09:22 +01:00
|
|
|
NICKNAME "Show the last used counterparty name" \
|
2020-06-18 15:02:17 +01:00
|
|
|
SERVICE "Monitor the YG service (INFO)" \
|
|
|
|
|
LOGS "View the last YG logfile (DEBUG)" \
|
2020-06-15 15:35:18 +01:00
|
|
|
STOP "Stop the YG service" \
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
CHOICE=$(dialog --clear \
|
|
|
|
|
--backtitle "$BACKTITLE" \
|
|
|
|
|
--title "$TITLE" \
|
|
|
|
|
--menu "$MENU" \
|
|
|
|
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
|
|
|
"${OPTIONS[@]}" \
|
|
|
|
|
2>&1 >/dev/tty)
|
|
|
|
|
|
|
|
|
|
case $CHOICE in
|
|
|
|
|
|
|
|
|
|
MAKER)
|
2020-06-22 15:15:28 +01:00
|
|
|
# wallet
|
|
|
|
|
chooseWallet
|
2020-06-26 10:56:00 +01:00
|
|
|
# save wallet in conf
|
2020-07-01 15:03:11 +01:00
|
|
|
sudo sed -i "s#^YGwallet=.*#YGwallet=$(cat $wallet)#g" /home/joinmarket/joinin.conf
|
2020-06-22 15:33:40 +01:00
|
|
|
# get password
|
|
|
|
|
passwordToFile
|
2020-06-22 15:15:28 +01:00
|
|
|
echo "Using the wallet: $(cat $wallet)"
|
|
|
|
|
/home/joinmarket/start.service.sh yg-privacyenhanced $(cat $wallet)
|
2020-06-15 15:35:18 +01:00
|
|
|
echo ""
|
2020-09-09 11:52:35 +01:00
|
|
|
echo "# started the Yield Generator in the background"
|
2020-06-15 15:35:18 +01:00
|
|
|
echo ""
|
2020-09-09 11:52:35 +01:00
|
|
|
echo "# showing the systemd status ..."
|
2020-06-15 15:35:18 +01:00
|
|
|
sleep 3
|
|
|
|
|
dialog \
|
|
|
|
|
--title "Monitoring the Yield Generator - press CTRL+C to exit" \
|
2020-09-30 14:31:34 +01:00
|
|
|
--prgbox "sudo journalctl -fn20 -u yg-privacyenhanced" 30 200
|
2020-09-09 11:52:35 +01:00
|
|
|
echo "# returning to the menu..."
|
2020-06-17 11:07:02 +01:00
|
|
|
sleep 1
|
2020-06-19 11:20:58 +01:00
|
|
|
/home/joinmarket/menu.yg.sh
|
2020-06-15 15:35:18 +01:00
|
|
|
;;
|
|
|
|
|
YGCONF)
|
|
|
|
|
/home/joinmarket/set.conf.sh /home/joinmarket/joinmarket-clientserver/scripts/yg-privacyenhanced.py
|
2020-09-09 11:52:35 +01:00
|
|
|
echo "# returning to the menu..."
|
2020-06-19 11:20:58 +01:00
|
|
|
/home/joinmarket/menu.yg.sh
|
2020-06-15 15:35:18 +01:00
|
|
|
;;
|
|
|
|
|
YGLIST)
|
|
|
|
|
dialog \
|
|
|
|
|
--title "timestamp cj amount/satoshi my input count my input value/satoshi cjfee/satoshi earned/satoshi confirm time/min notes" \
|
2020-10-28 14:06:38 +00:00
|
|
|
--prgbox "column /home/joinmarket/.joinmarket/logs/yigen-statement.csv -t -s ","" 100 140
|
2020-09-09 11:52:35 +01:00
|
|
|
echo "# returning to the menu..."
|
2020-06-17 11:07:02 +01:00
|
|
|
sleep 1
|
2020-06-19 11:20:58 +01:00
|
|
|
/home/joinmarket/menu.yg.sh
|
2020-06-15 15:35:18 +01:00
|
|
|
;;
|
2020-06-20 13:09:22 +01:00
|
|
|
NICKNAME)
|
2020-06-18 14:08:25 +01:00
|
|
|
name=$(ls -t /home/joinmarket/.joinmarket/logs | grep J5 | head -n 1 | cut -c -16)
|
|
|
|
|
whiptail \
|
|
|
|
|
--title "Counterparty name" \
|
2020-10-27 15:07:16 +00:00
|
|
|
--msgbox "The last used counterparty name for the Order Book:\n
|
2020-06-18 14:08:25 +01:00
|
|
|
$name\n
|
2021-01-19 22:38:00 +00:00
|
|
|
Check if active in: https://nixbitcoin.org/obwatcher/
|
2020-10-27 15:07:16 +00:00
|
|
|
or use the local Order Book" 12 55
|
2020-06-18 17:33:57 +01:00
|
|
|
echo "Returning to the menu..."
|
|
|
|
|
sleep 1
|
2020-06-19 11:20:58 +01:00
|
|
|
/home/joinmarket/menu.yg.sh
|
2020-06-18 15:02:17 +01:00
|
|
|
;;
|
|
|
|
|
SERVICE)
|
|
|
|
|
dialog \
|
|
|
|
|
--title "Monitoring the Yield Generator" \
|
|
|
|
|
--msgbox "
|
2020-06-26 10:56:00 +01:00
|
|
|
Shows the service status with INFO logs using:
|
2020-06-18 15:02:17 +01:00
|
|
|
|
2020-06-26 10:56:00 +01:00
|
|
|
sudo systemctl status yg-privacyenhanced
|
2020-06-18 15:02:17 +01:00
|
|
|
|
2020-06-19 11:20:58 +01:00
|
|
|
Press CTRL+C to exit to the command line.
|
|
|
|
|
Use: 'menu' for the JoininBox options." 11 50
|
2020-06-26 10:56:00 +01:00
|
|
|
sudo systemctl status yg-privacyenhanced
|
2020-06-18 15:02:17 +01:00
|
|
|
;;
|
2020-06-17 14:24:41 +01:00
|
|
|
LOGS)
|
|
|
|
|
dialog \
|
|
|
|
|
--title "Monitoring the Yield Generator" \
|
|
|
|
|
--msgbox "
|
|
|
|
|
Will tail the latest YG logfile from:
|
|
|
|
|
|
|
|
|
|
/home/joinmarket/.joinmarket/logs/
|
|
|
|
|
|
|
|
|
|
Press CTRL+C to exit and return to the menu." 10 50
|
2020-06-18 13:48:29 +01:00
|
|
|
cd /home/joinmarket/.joinmarket/logs
|
|
|
|
|
ls -t | grep J5 | head -n 1 | xargs tail -fn1000
|
2020-09-09 09:50:47 +01:00
|
|
|
echo ""
|
2020-06-17 14:24:41 +01:00
|
|
|
echo "Press ENTER to return to menu"
|
|
|
|
|
read key
|
2020-06-18 13:48:29 +01:00
|
|
|
cd /home/joinmarket/joinmarket-clientserver/scripts/
|
2020-06-19 11:20:58 +01:00
|
|
|
/home/joinmarket/menu.yg.sh
|
2020-06-17 14:24:41 +01:00
|
|
|
;;
|
2020-06-15 15:35:18 +01:00
|
|
|
STOP)
|
2020-09-09 11:20:41 +01:00
|
|
|
stopYG
|
2020-09-09 09:50:47 +01:00
|
|
|
echo ""
|
2020-06-18 13:48:29 +01:00
|
|
|
echo "Press ENTER to return to the menu..."
|
|
|
|
|
read key
|
2020-06-15 15:35:18 +01:00
|
|
|
;;
|
2020-06-18 15:02:17 +01:00
|
|
|
esac
|