Skip to content

Commit

Permalink
stop the YG before updating JoinMarket
Browse files Browse the repository at this point in the history
  • Loading branch information
openoms committed Sep 9, 2020
1 parent 5922c6d commit 8710c62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
7 changes: 3 additions & 4 deletions scripts/install.joinmarket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function installJoinMarket() {
version="v0.7.0"
cd /home/joinmarket
# PySide2 for armf: https://packages.debian.org/buster/python3-pyside2.qtcore
echo "# installing ARM specific dependencies to run the QT GUI on ARM"
echo "# installing ARM specific dependencies to run the QT GUI"
sudo apt install -y python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets zlib1g-dev libjpeg-dev
echo "# installing JoinMarket"
sudo -u joinmarket git clone https://github.com/Joinmarket-Org/joinmarket-clientserver
Expand Down Expand Up @@ -81,9 +81,8 @@ if [ "$1" = "config" ]; then
fi

if [ "$1" = "update" ]; then
. menu.yg.sh stopYG
echo "# exiting jmvenv"
deactivate
source /home/joinmarket/menu.functions.sh
stopYG
echo "# deleting the joinmarket-clientserver directory"
sudo rm -rf /home/joinmarket/joinmarket-clientserver
installJoinMarket
Expand Down
19 changes: 19 additions & 0 deletions scripts/menu.functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,22 @@ else
echo "$defaultWallet" > "$wallet"
fi
}

function stopYG() {
# stop the background process (equivalent to CTRL+C)
# use wallet from joinin.conf
source /home/joinmarket/joinin.conf
pkill -sigint -f "python yg-privacyenhanced.py $YGwallet --wallet-password-stdin"
# pgrep python | xargs kill -sigint
# remove the service
sudo systemctl stop yg-privacyenhanced
sudo systemctl disable yg-privacyenhanced
# check for failed services
# sudo systemctl list-units --type=service
sudo systemctl reset-failed
# make sure the lock file is deleted
rm -f ~/.joinmarket/wallets/.$wallet.lock
# for old version <v0.6.3
rm -f ~/.joinmarket/wallets/$wallet.lock 2>/dev/null
echo "# stopped the Yield Generator background service"
}
6 changes: 4 additions & 2 deletions scripts/menu.update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "# copying the scripts in place"
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/* /home/joinmarket/
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/.* /home/joinmarket/ 2>/dev/null
sudo -u joinmarket chmod +x /home/joinmarket/*.sh
echo "# updated the JoininBox menu and scripts to the latest master"
echo "# updated the JoininBox menu and scripts to the latest state in https://github.com/openoms/joininbox"
}

# BASIC MENU INFO
Expand Down Expand Up @@ -40,7 +40,9 @@ CHOICE=$(dialog --clear \
case $CHOICE in
JOININBOX)
updateJoininBox
exit 0
echo ""
echo "Press ENTER to return to the menu"
read key
;;
JOINMARKET)
/home/joinmarket/install.joinmarket.sh update
Expand Down
30 changes: 5 additions & 25 deletions scripts/menu.yg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@ fi
source /home/joinmarket/menu.functions.sh
source /home/joinmarket/joinin.conf

# functions
function stopYG() {
# stop the background process (equivalent to CTRL+C)
# use wallet from joinin.conf
source /home/joinmarket/joinin.conf
pkill -sigint -f "python yg-privacyenhanced.py $YGwallet --wallet-password-stdin"
# pgrep python | xargs kill -sigint
# remove the service
sudo systemctl stop yg-privacyenhanced
sudo systemctl disable yg-privacyenhanced
# check for failed services
# sudo systemctl list-units --type=service
sudo systemctl reset-failed
# make sure the lock file is deleted
rm -f ~/.joinmarket/wallets/.$wallet.lock
# for old version <v0.6.3
rm -f ~/.joinmarket/wallets/$wallet.lock 2>/dev/null
echo "Stopped the Yield Generator background service"
}

# BASIC MENU INFO
HEIGHT=15
WIDTH=52
Expand Down Expand Up @@ -70,27 +50,27 @@ case $CHOICE in
echo "Using the wallet: $(cat $wallet)"
/home/joinmarket/start.service.sh yg-privacyenhanced $(cat $wallet)
echo ""
echo "Started the Yield Generator in the background"
echo "# started the Yield Generator in the background"
echo ""
echo "Showing the systemd status ..."
echo "# showing the systemd status ..."
sleep 3
dialog \
--title "Monitoring the Yield Generator - press CTRL+C to exit" \
--prgbox "sudo journalctl -fn20 -u yg-privacyenhanced" 30 140
echo "Returning to the menu..."
echo "# returning to the menu..."
sleep 1
/home/joinmarket/menu.yg.sh
;;
YGCONF)
/home/joinmarket/set.conf.sh /home/joinmarket/joinmarket-clientserver/scripts/yg-privacyenhanced.py
echo "Returning to the menu..."
echo "# returning to the menu..."
/home/joinmarket/menu.yg.sh
;;
YGLIST)
dialog \
--title "timestamp cj amount/satoshi my input count my input value/satoshi cjfee/satoshi earned/satoshi confirm time/min notes" \
--prgbox "column $HOME/.joinmarket/logs/yigen-statement.csv -t -s ","" 100 140
echo "Returning to the menu..."
echo "# returning to the menu..."
sleep 1
/home/joinmarket/menu.yg.sh
;;
Expand Down

0 comments on commit 8710c62

Please sign in to comment.