Check for running instance

This commit is contained in:
nahuhh 2024-09-16 20:58:53 +00:00
parent e8f3a7d964
commit 1beef16e0d
8 changed files with 118 additions and 7 deletions

View file

@ -1,5 +1,21 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
python3 -m venv "$SWAP_DATADIR/venv"
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m"
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is already running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/startup.sh $HOME/.local/bin/bsx/startup.sh

View file

@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n" echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
;; ;;
esac esac
done done
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/addcoin.sh $HOME/.local/bin/bsx/addcoin.sh

View file

@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n" echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
;; ;;
esac esac
done done
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/disabletor.sh $HOME/.local/bin/bsx/disabletor.sh

View file

@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n" echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
;; ;;
esac esac
done done
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/enabletor.sh $HOME/.local/bin/bsx/enabletor.sh

View file

@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n" echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
;; ;;
esac esac
done done
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/removecoin.sh $HOME/.local/bin/bsx/removecoin.sh

View file

@ -1,5 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
if [ -f /usr/local/bin/bsx/update.sh ]; then if [ -f /usr/local/bin/bsx/update.sh ]; then

View file

@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n" echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
;; ;;
esac esac
done done
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/upgradecoins.sh $HOME/.local/bin/bsx/upgradecoins.sh

View file

@ -1,10 +1,23 @@
#/bin/bash #/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is already installed.\n"; $nocolor
exit
fi
fi
fi
# Title Bar # Title Bar
$green "\n" $green "\n"
title="BasicSwapDEX Installer" title="BasicSwapDEX Installer"
@ -187,7 +200,6 @@ if [[ $xfce_chek ]]; then
fi fi
## Make venv and set variables for install ## Make venv and set variables for install
export SWAP_DATADIR=$HOME/coinswaps
export monerod_addr=$monerod_addr export monerod_addr=$monerod_addr
export monerod_port=$monerod_port export monerod_port=$monerod_port
export particl_mnemonic=$particl_mnemonic export particl_mnemonic=$particl_mnemonic