2020-01-20 01:03:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2020-06-17 10:14:56 +01:00
|
|
|
source /home/joinmarket/joinin.conf
|
2020-01-20 01:03:09 +00:00
|
|
|
|
2020-06-13 19:25:26 +01:00
|
|
|
script="$1"
|
|
|
|
|
wallet="$2"
|
2020-01-21 23:25:32 +00:00
|
|
|
|
2020-06-13 22:22:15 +01:00
|
|
|
echo ""
|
|
|
|
|
echo "Making sure $script not running"
|
2020-06-13 19:25:26 +01:00
|
|
|
sudo systemctl stop $script
|
|
|
|
|
sudo systemctl disable $script
|
2020-01-21 23:25:32 +00:00
|
|
|
|
2020-06-13 19:25:26 +01:00
|
|
|
if [ $script == "yg-privacyenhanced" ]; then
|
2020-07-01 12:05:50 +01:00
|
|
|
# shut down the process gracefully
|
2020-06-17 22:35:48 +01:00
|
|
|
pkill -sigint -f "python yg-privacyenhanced.py $wallet --wallet-password-stdin"
|
2020-07-01 12:05:50 +01:00
|
|
|
# make sure the lock file is deleted
|
|
|
|
|
rm -f ~/.joinmarket/wallets/.$wallet.lock
|
|
|
|
|
# for old version <v0.6.3
|
2020-08-19 08:42:12 +01:00
|
|
|
rm -f ~/.joinmarket/wallets/$wallet.lock 2>/dev/null
|
2020-06-13 19:25:26 +01:00
|
|
|
fi
|
2020-04-15 14:23:29 +01:00
|
|
|
|
2020-06-21 00:42:29 +01:00
|
|
|
if [ ${RPCoverTor} = "on" ];then
|
2020-06-15 15:36:38 +01:00
|
|
|
tor="torify"
|
2020-04-15 14:23:29 +01:00
|
|
|
else
|
2020-06-15 15:36:38 +01:00
|
|
|
tor=""
|
2020-04-15 14:23:29 +01:00
|
|
|
fi
|
|
|
|
|
|
2020-06-21 01:03:29 +01:00
|
|
|
startScript="cat /home/joinmarket/.pw | $tor python $script.py $wallet \
|
|
|
|
|
--wallet-password-stdin"
|
2020-06-22 14:11:58 +01:00
|
|
|
# display
|
2020-06-22 20:51:26 +01:00
|
|
|
echo "
|
|
|
|
|
Running the command with systemd:
|
2020-07-16 13:03:31 +01:00
|
|
|
$tor python $script.py $(echo $wallet | sed "s#$walletPath##g")"
|
2020-06-15 15:36:38 +01:00
|
|
|
|
2020-01-20 01:03:09 +00:00
|
|
|
echo "
|
|
|
|
|
[Unit]
|
2020-06-13 19:25:26 +01:00
|
|
|
Description=$script
|
2020-01-20 01:03:09 +00:00
|
|
|
|
|
|
|
|
[Service]
|
2020-03-18 11:01:32 +00:00
|
|
|
WorkingDirectory=/home/joinmarket/joinmarket-clientserver/scripts/
|
2020-06-21 01:03:29 +01:00
|
|
|
ExecStart=/bin/sh -c \
|
|
|
|
|
'. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate && $startScript'
|
2020-03-18 11:01:32 +00:00
|
|
|
User=joinmarket
|
|
|
|
|
Group=joinmarket
|
2020-01-20 01:03:09 +00:00
|
|
|
Type=simple
|
|
|
|
|
KillMode=process
|
2020-06-17 15:11:18 +01:00
|
|
|
TimeoutSec=infinity
|
2020-01-21 23:25:32 +00:00
|
|
|
Restart=no
|
2020-01-20 01:03:09 +00:00
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|
2020-06-13 19:25:26 +01:00
|
|
|
" | sudo tee /etc/systemd/system/$script.service 1>/dev/null
|
|
|
|
|
|
2020-06-22 20:51:26 +01:00
|
|
|
echo "
|
|
|
|
|
Starting the systemd service: $script
|
|
|
|
|
"
|
2020-06-13 22:22:15 +01:00
|
|
|
|
2020-06-13 19:25:26 +01:00
|
|
|
sudo systemctl enable $script
|
|
|
|
|
sudo systemctl start $script
|
2020-06-13 13:31:25 +01:00
|
|
|
|
2020-06-22 20:51:26 +01:00
|
|
|
echo "
|
|
|
|
|
Shredding the password once used...
|
|
|
|
|
"
|
2020-06-13 22:30:53 +01:00
|
|
|
|
|
|
|
|
sleep 5
|
2020-06-13 21:51:48 +01:00
|
|
|
# delete password once used
|
2020-06-18 13:46:56 +01:00
|
|
|
shred -uvz /home/joinmarket/.pw
|