From 323bfe90d180abfca2a229e509f2b1c29c3420e3 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 8 Jan 2018 16:31:36 -0800 Subject: [PATCH 01/35] Create loadprofile --- loadprofile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 loadprofile diff --git a/loadprofile b/loadprofile new file mode 100644 index 0000000..ad6803e --- /dev/null +++ b/loadprofile @@ -0,0 +1,47 @@ +#!/bin/bash +function load { +cd ~/ProfitTrailer +cp application.properties application.properties.backup +cp configuration.properties configuration.properties.backup +cp trading/PAIRS.properties trading/PAIRS.properties.backup +cp trading/INDICATORS.properties trading/INDICATORS.properties.backup +cp trading/DCA.properties trading/DCA.properties.backup +cp ~/app.prop/application.properties.$PROFILE application.properties +curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/configuration.properties > configuration.properties +curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/INDICATORS.properties > trading/INDICATORS.properties +curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/PAIRS.properties > trading/PAIRS.properties +curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/DCA.properties > trading/DCA.properties +echo $PROFILE loaded. +} +function unload { +cd ~/ProfitTrailer +cp application.properties.backup application.properties +cp configuration.properties.backup configuration.properties +cp trading/PAIRS.properties.backup trading/PAIRS.properties +cp trading/INDICATORS.properties.backup trading/INDICATORS.properties +cp trading/DCA.properties.backup trading/DCA.properties +echo Backups restored +} +curl https://raw.githubusercontent.com/tomohern/PTS/master/profiles > ~/profiles.txt +VALUES=$(<~/profiles.txt) +OPTIONS="$VALUES Restore Quit" +select opt in $OPTIONS; do + if [ "$opt" = "Quit" ]; then + echo done + exit + elif [ "$opt" = "BTFD" ]; then + PROFILE=BTFD + load + elif [ "$opt" = "ccbull" ]; then + PROFILE=ccbull + load + elif [ "$opt" = "ccbear" ]; then + PROFILE=ccbear + load + elif [ "$opt" = "Restore" ]; then + unload + else + clear + echo bad option + fi +done From 19323c5779e5499d4194f7c4183aaaa23fba566d Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 13:34:54 -0800 Subject: [PATCH 02/35] Create setup --- setup | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 setup diff --git a/setup b/setup new file mode 100644 index 0000000..60b1f10 --- /dev/null +++ b/setup @@ -0,0 +1,9 @@ +#!/bin/bash +echo Enter Desired Username: +read uname +adduser $uname +usermod -aG sudo $uname +su - $uname +wget $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) +apt install unzip +unzip ProfitTrailer.zip From 5bad9d598c966c5efcbe12e2deb48af4eb3afd9f Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 13:35:33 -0800 Subject: [PATCH 03/35] Create profittrailer --- profittrailer | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 profittrailer diff --git a/profittrailer b/profittrailer new file mode 100644 index 0000000..6a89c6b --- /dev/null +++ b/profittrailer @@ -0,0 +1,3 @@ +#!/bin/bash +cd ~/ProfitTrailer +sudo java -jar ProfitTrailer.jar -XX:+UseConcMarkSweepGC -Xmx512m -Xms512m From 865fb4d073869a80bb80a41844b5fc13bd74019c Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 14:33:02 -0800 Subject: [PATCH 04/35] Update setup --- setup | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/setup b/setup index 60b1f10..90c076e 100644 --- a/setup +++ b/setup @@ -3,7 +3,16 @@ echo Enter Desired Username: read uname adduser $uname usermod -aG sudo $uname -su - $uname -wget $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) +apt update +apt install openjdk-8-jre-headless apt install unzip +curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer +chmod +x /usr/local/bin/profittrailer +curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile +chmod +x /usr/local/bin/loadprofile +su - $uname +curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) unzip ProfitTrailer.zip +mv ProfitTrailer.zip ProfitTrailer_$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8).zip +mkdir app.prop +cp ~/ProfitTrailer/application.properties ~/app.prop/application.properties.DEFAULT From 5f435d8ae529b7f5ed3a3bc9083df7558ec5d9d7 Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 14:35:44 -0800 Subject: [PATCH 05/35] Update setup --- setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup b/setup index 90c076e..516b0d4 100644 --- a/setup +++ b/setup @@ -11,7 +11,7 @@ chmod +x /usr/local/bin/profittrailer curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile chmod +x /usr/local/bin/loadprofile su - $uname -curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) +wget $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8).zip mkdir app.prop From 5cb0f7a31eef461a2b3e350a70c68a3489e27e34 Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 15:22:23 -0800 Subject: [PATCH 06/35] Update setup --- setup | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/setup b/setup index 516b0d4..697c22c 100644 --- a/setup +++ b/setup @@ -10,9 +10,11 @@ curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr chmod +x /usr/local/bin/profittrailer curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile chmod +x /usr/local/bin/loadprofile +#curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) > /home/$uname/ProfitTrailer.zip +ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) +runuser -l $uname -c 'curl https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip > /home/$uname/ProfitTrailer.zip' +runuser -l $uname -c 'unzip /home/$uname/ProfitTrailer.zip' +runuser -l $uname -c 'mv ProfitTrailer.zip ProfitTrailer_$ver.zip' +runuser -l $uname -c 'mkdir /home/$uname/app.prop' +runuser -l $uname -c 'cp /home/$uname/ProfitTrailer/application.properties /home/$uname/app.prop/application.properties.DEFAULT' su - $uname -wget $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) -unzip ProfitTrailer.zip -mv ProfitTrailer.zip ProfitTrailer_$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8).zip -mkdir app.prop -cp ~/ProfitTrailer/application.properties ~/app.prop/application.properties.DEFAULT From 40931c10f6a5eeda7062fe7e1f9fee2d52699dd6 Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 15:59:06 -0800 Subject: [PATCH 07/35] Update setup --- setup | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/setup b/setup index 697c22c..cb09ced 100644 --- a/setup +++ b/setup @@ -10,11 +10,7 @@ curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr chmod +x /usr/local/bin/profittrailer curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile chmod +x /usr/local/bin/loadprofile -#curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) > /home/$uname/ProfitTrailer.zip -ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) -runuser -l $uname -c 'curl https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip > /home/$uname/ProfitTrailer.zip' -runuser -l $uname -c 'unzip /home/$uname/ProfitTrailer.zip' -runuser -l $uname -c 'mv ProfitTrailer.zip ProfitTrailer_$ver.zip' -runuser -l $uname -c 'mkdir /home/$uname/app.prop' -runuser -l $uname -c 'cp /home/$uname/ProfitTrailer/application.properties /home/$uname/app.prop/application.properties.DEFAULT' +curl https://raw.githubusercontent.com/tomohern/PTS/scripts/setup2 > /usr/local/bin/setup2 +chmod +x /usr/local/bin/setup2 +echo Please execute 'setup2' su - $uname From 926456ff7c1915e9f0dc76a23bb9d8811e3a42ff Mon Sep 17 00:00:00 2001 From: tomohern Date: Tue, 9 Jan 2018 16:00:05 -0800 Subject: [PATCH 08/35] Create setup2 --- setup2 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 setup2 diff --git a/setup2 b/setup2 new file mode 100644 index 0000000..c64ecf5 --- /dev/null +++ b/setup2 @@ -0,0 +1,7 @@ +#curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) > /home/$uname/ProfitTrailer.zip +ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) +curl https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip > /home/$uname/ProfitTrailer.zip +unzip /home/$uname/ProfitTrailer.zip +mv ProfitTrailer.zip ProfitTrailer_$ver.zip +mkdir /home/$uname/app.prop +cp /home/$uname/ProfitTrailer/application.properties /home/$uname/app.prop/application.properties.DEFAULT From ded797b12d67239202b4d56fc37df2d93d1f1db2 Mon Sep 17 00:00:00 2001 From: tomohern Date: Wed, 10 Jan 2018 09:12:04 -0800 Subject: [PATCH 09/35] Update setup --- setup | 1 + 1 file changed, 1 insertion(+) diff --git a/setup b/setup index cb09ced..be0bda2 100644 --- a/setup +++ b/setup @@ -4,6 +4,7 @@ read uname adduser $uname usermod -aG sudo $uname apt update +unattended-upgrades -d apt install openjdk-8-jre-headless apt install unzip curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer From eb7c9e03b348a5cf29c535a6b66c47aa4f9a4825 Mon Sep 17 00:00:00 2001 From: tomohern Date: Wed, 10 Jan 2018 09:18:59 -0800 Subject: [PATCH 10/35] Update setup2 --- setup2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup2 b/setup2 index c64ecf5..0b92dbe 100644 --- a/setup2 +++ b/setup2 @@ -1,7 +1,7 @@ #curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) > /home/$uname/ProfitTrailer.zip ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) -curl https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip > /home/$uname/ProfitTrailer.zip -unzip /home/$uname/ProfitTrailer.zip +wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip +unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$ver.zip -mkdir /home/$uname/app.prop -cp /home/$uname/ProfitTrailer/application.properties /home/$uname/app.prop/application.properties.DEFAULT +mkdir app.prop +cp ProfitTrailer/application.properties /app.prop/application.properties.DEFAULT From 60729f77a1dbf5623c10d82eb7b58d6e6a473ddb Mon Sep 17 00:00:00 2001 From: tomohern Date: Wed, 10 Jan 2018 11:48:23 -0800 Subject: [PATCH 11/35] Create moveserver --- moveserver | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 moveserver diff --git a/moveserver b/moveserver new file mode 100644 index 0000000..fb95e92 --- /dev/null +++ b/moveserver @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Replace DestinationServerPassword, UserName, and DesintationServer as needed. +# +zip -r pt.zip * +sshpass -v -p "DestinationServerPassword" sftp -oBatchMode=no -b - UserName@DesintationServer << ! + put pt.zip + bye +! From 314a570af3adc3f452e631aa9991f1f8d8ab456c Mon Sep 17 00:00:00 2001 From: tomohern Date: Thu, 11 Jan 2018 08:29:34 -0800 Subject: [PATCH 12/35] Update loadprofile --- loadprofile | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/loadprofile b/loadprofile index ad6803e..81ff5a7 100644 --- a/loadprofile +++ b/loadprofile @@ -1,5 +1,5 @@ #!/bin/bash -function load { +function LoadProfile { cd ~/ProfitTrailer cp application.properties application.properties.backup cp configuration.properties configuration.properties.backup @@ -13,7 +13,7 @@ curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/PAIRS.properties > curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/DCA.properties > trading/DCA.properties echo $PROFILE loaded. } -function unload { +function RestoreBackup { cd ~/ProfitTrailer cp application.properties.backup application.properties cp configuration.properties.backup configuration.properties @@ -22,26 +22,20 @@ cp trading/INDICATORS.properties.backup trading/INDICATORS.properties cp trading/DCA.properties.backup trading/DCA.properties echo Backups restored } -curl https://raw.githubusercontent.com/tomohern/PTS/master/profiles > ~/profiles.txt -VALUES=$(<~/profiles.txt) +VALUES=$(curl -s "https://api.github.com/repos/tomohern/PTS/branches" | grep '"name":' | sed -e 's/.*:\s\+"\([^"]\+\).*/\1/g' -e 's/master//g' -e 's/scripts//g' | tr '\n' ' ') OPTIONS="$VALUES Restore Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then echo done exit - elif [ "$opt" = "BTFD" ]; then - PROFILE=BTFD - load - elif [ "$opt" = "ccbull" ]; then - PROFILE=ccbull - load - elif [ "$opt" = "ccbear" ]; then - PROFILE=ccbear - load elif [ "$opt" = "Restore" ]; then - unload + RestoreBackup + elif [ "$opt" != "" ]; then + PROFILE=$opt + LoadProfile else clear - echo bad option + echo Bad Option fi done + From 9c45a15d0acdfb4b6716469874ab4a8f6b8d8813 Mon Sep 17 00:00:00 2001 From: tomohern Date: Thu, 11 Jan 2018 09:42:08 -0800 Subject: [PATCH 13/35] Update and rename setup2 to downloadLatestPT --- setup2 => downloadLatestPT | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename setup2 => downloadLatestPT (52%) diff --git a/setup2 b/downloadLatestPT similarity index 52% rename from setup2 rename to downloadLatestPT index 0b92dbe..69c208f 100644 --- a/setup2 +++ b/downloadLatestPT @@ -1,7 +1,9 @@ -#curl $(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d\" -f4) > /home/$uname/ProfitTrailer.zip +#!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$ver.zip -mkdir app.prop -cp ProfitTrailer/application.properties /app.prop/application.properties.DEFAULT +if [ ! -d "~/app.prop" ]; then + mkdir app.prop +fi +cp ProfitTrailer/application.properties app.prop/application.properties.DEFAULT From e44033906ee3c190fde2f3e18a8a2e99d435d46f Mon Sep 17 00:00:00 2001 From: tomohern Date: Thu, 11 Jan 2018 09:42:48 -0800 Subject: [PATCH 14/35] Update setup --- setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup b/setup index be0bda2..1747265 100644 --- a/setup +++ b/setup @@ -11,7 +11,7 @@ curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr chmod +x /usr/local/bin/profittrailer curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile chmod +x /usr/local/bin/loadprofile -curl https://raw.githubusercontent.com/tomohern/PTS/scripts/setup2 > /usr/local/bin/setup2 -chmod +x /usr/local/bin/setup2 -echo Please execute 'setup2' +curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT +chmod +x /usr/local/bin/downloadLatestPT +echo Please execute 'downloadLatestPT' su - $uname From 591885b1cfec27d32223a88b5bdfe9992a7a1883 Mon Sep 17 00:00:00 2001 From: tomohern Date: Thu, 11 Jan 2018 11:36:07 -0800 Subject: [PATCH 15/35] Update setup --- setup | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/setup b/setup index 1747265..1a82346 100644 --- a/setup +++ b/setup @@ -1,17 +1,37 @@ #!/bin/bash -echo Enter Desired Username: -read uname -adduser $uname -usermod -aG sudo $uname +# +#Update and install needed software +# apt update unattended-upgrades -d apt install openjdk-8-jre-headless apt install unzip +# +#Install needed scripts +# curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer chmod +x /usr/local/bin/profittrailer curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile chmod +x /usr/local/bin/loadprofile curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT chmod +x /usr/local/bin/downloadLatestPT -echo Please execute 'downloadLatestPT' -su - $uname +# +# Create new user to run PT as +# +read -p "Create New User? (If not, will continue as Root)" -n 1 -r +echo # (optional) move to a new line +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo Enter Desired Username: + read uname + adduser $uname + usermod -aG sudo $uname + echo Please execute 'downloadLatestPT' + su - $uname + exit +else +downloadLatestPT +fi + + + From 145a9ffa483165ea0949aecf845730c726f64f75 Mon Sep 17 00:00:00 2001 From: tomohern Date: Thu, 11 Jan 2018 14:19:43 -0800 Subject: [PATCH 16/35] Update loadprofile --- loadprofile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/loadprofile b/loadprofile index 81ff5a7..ce9c345 100644 --- a/loadprofile +++ b/loadprofile @@ -7,10 +7,10 @@ cp trading/PAIRS.properties trading/PAIRS.properties.backup cp trading/INDICATORS.properties trading/INDICATORS.properties.backup cp trading/DCA.properties trading/DCA.properties.backup cp ~/app.prop/application.properties.$PROFILE application.properties -curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/configuration.properties > configuration.properties -curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/INDICATORS.properties > trading/INDICATORS.properties -curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/PAIRS.properties > trading/PAIRS.properties -curl https://raw.githubusercontent.com/tomohern/PTS/$PROFILE/DCA.properties > trading/DCA.properties +curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/configuration.properties > configuration.properties +curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/INDICATORS.properties > trading/INDICATORS.properties +curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/PAIRS.properties > trading/PAIRS.properties +curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/DCA.properties > trading/DCA.properties echo $PROFILE loaded. } function RestoreBackup { @@ -22,7 +22,7 @@ cp trading/INDICATORS.properties.backup trading/INDICATORS.properties cp trading/DCA.properties.backup trading/DCA.properties echo Backups restored } -VALUES=$(curl -s "https://api.github.com/repos/tomohern/PTS/branches" | grep '"name":' | sed -e 's/.*:\s\+"\([^"]\+\).*/\1/g' -e 's/master//g' -e 's/scripts//g' | tr '\n' ' ') +VALUES=$(curl -s "https://api.github.com/repos/tomohern/PTSettings/branches" | grep '"name":' | sed -e 's/.*:\s\+"\([^"]\+\).*/\1/g' -e 's/master/Default/g' | tr '\n' ' ') OPTIONS="$VALUES Restore Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then @@ -30,9 +30,15 @@ select opt in $OPTIONS; do exit elif [ "$opt" = "Restore" ]; then RestoreBackup + exit + elif [ "$opt" = "Default" ]; then + PROFILE=master + LoadProfile + exit elif [ "$opt" != "" ]; then PROFILE=$opt LoadProfile + exit else clear echo Bad Option From efe29455bf0839c1d6c4a752067086e460ad9e84 Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 10:36:02 -0800 Subject: [PATCH 17/35] Update downloadLatestPT --- downloadLatestPT | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/downloadLatestPT b/downloadLatestPT index 69c208f..776de53 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -1,9 +1,9 @@ #!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -unzip ProfitTrailer.zip +#unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$ver.zip -if [ ! -d "~/app.prop" ]; then - mkdir app.prop -fi -cp ProfitTrailer/application.properties app.prop/application.properties.DEFAULT +#if [ ! -d "~/app.prop" ]; then +# mkdir app.prop +#fi +#cp ProfitTrailer/application.properties app.prop/application.properties.DEFAULT From 4925fad753b582e9e81bab47973923726208575b Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 11:28:02 -0800 Subject: [PATCH 18/35] Create updatescripts --- updatescripts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 updatescripts diff --git a/updatescripts b/updatescripts new file mode 100644 index 0000000..7db0970 --- /dev/null +++ b/updatescripts @@ -0,0 +1,9 @@ +#!/bin/bash +#Install needed scripts +# +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer +sudo chmod +x /usr/local/bin/profittrailer +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile +sudo chmod +x /usr/local/bin/loadprofile +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT +sudo chmod +x /usr/local/bin/downloadLatestPT From cb5f4b0398dec23f15dae5b8fdd9249b3691d0ec Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 11:34:53 -0800 Subject: [PATCH 19/35] Update setup --- setup | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/setup b/setup index 1a82346..ca948d2 100644 --- a/setup +++ b/setup @@ -7,15 +7,6 @@ unattended-upgrades -d apt install openjdk-8-jre-headless apt install unzip # -#Install needed scripts -# -curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer -chmod +x /usr/local/bin/profittrailer -curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile -chmod +x /usr/local/bin/loadprofile -curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT -chmod +x /usr/local/bin/downloadLatestPT -# # Create new user to run PT as # read -p "Create New User? (If not, will continue as Root)" -n 1 -r @@ -32,6 +23,20 @@ then else downloadLatestPT fi +# +#Install needed scripts +# +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/updatescripts > /home/$uname/updatescripts +sudo chmod +x /home/$uname/updatescripts +updatescripts +# +#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer +#chmod +x /usr/local/bin/profittrailer +#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile +#chmod +x /usr/local/bin/loadprofile +#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT +#chmod +x /usr/local/bin/downloadLatestPT + From dda59242129df55851af4183d2ea134f1063b3d7 Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 11:35:37 -0800 Subject: [PATCH 20/35] Update updatescripts --- updatescripts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/updatescripts b/updatescripts index 7db0970..8ab6ae4 100644 --- a/updatescripts +++ b/updatescripts @@ -1,9 +1,9 @@ #!/bin/bash #Install needed scripts # -sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer -sudo chmod +x /usr/local/bin/profittrailer -sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > profittrailer +sudo chmod +x profittrailer +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > loadprofile sudo chmod +x /usr/local/bin/loadprofile -sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > downloadLatestPT sudo chmod +x /usr/local/bin/downloadLatestPT From 2cdc2417f2d12ea0c1c27cdbbccd92aaca5b66da Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 11:37:10 -0800 Subject: [PATCH 21/35] Update updatescripts --- updatescripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updatescripts b/updatescripts index 8ab6ae4..1189a31 100644 --- a/updatescripts +++ b/updatescripts @@ -4,6 +4,6 @@ sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > profittrailer sudo chmod +x profittrailer sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > loadprofile -sudo chmod +x /usr/local/bin/loadprofile +sudo chmod +x loadprofile sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > downloadLatestPT -sudo chmod +x /usr/local/bin/downloadLatestPT +sudo chmod +x downloadLatestPT From 30c9fca53c48c9eee319f106e6eb175639c7760e Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 13:46:24 -0800 Subject: [PATCH 22/35] Update downloadLatestPT --- downloadLatestPT | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/downloadLatestPT b/downloadLatestPT index 776de53..7161ca5 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -1,9 +1,6 @@ #!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) +cd ~/new +rm -rf ~/new/ProfitTrailer/ wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -#unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$ver.zip -#if [ ! -d "~/app.prop" ]; then -# mkdir app.prop -#fi -#cp ProfitTrailer/application.properties app.prop/application.properties.DEFAULT From 6d942e3f35be1689f2d51bea23c9943ba9a13498 Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 13:49:11 -0800 Subject: [PATCH 23/35] Update downloadLatestPT --- downloadLatestPT | 1 + 1 file changed, 1 insertion(+) diff --git a/downloadLatestPT b/downloadLatestPT index 7161ca5..f145bae 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -3,4 +3,5 @@ ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/lates cd ~/new rm -rf ~/new/ProfitTrailer/ wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip +unzip ProfitTrailer.zip mv ProfitTrailer.zip ProfitTrailer_$ver.zip From b4ead3e11a66a26d65c4e2005fd8a3054a308078 Mon Sep 17 00:00:00 2001 From: tomohern Date: Fri, 26 Jan 2018 15:37:01 -0800 Subject: [PATCH 24/35] Update loadprofile --- loadprofile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/loadprofile b/loadprofile index ce9c345..4448268 100644 --- a/loadprofile +++ b/loadprofile @@ -1,28 +1,28 @@ #!/bin/bash + +SOURCE=tomohern/PTSettings + function LoadProfile { cd ~/ProfitTrailer -cp application.properties application.properties.backup cp configuration.properties configuration.properties.backup cp trading/PAIRS.properties trading/PAIRS.properties.backup cp trading/INDICATORS.properties trading/INDICATORS.properties.backup cp trading/DCA.properties trading/DCA.properties.backup -cp ~/app.prop/application.properties.$PROFILE application.properties -curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/configuration.properties > configuration.properties -curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/INDICATORS.properties > trading/INDICATORS.properties -curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/PAIRS.properties > trading/PAIRS.properties -curl https://raw.githubusercontent.com/tomohern/PTSettings/$PROFILE/DCA.properties > trading/DCA.properties +curl https://raw.githubusercontent.com/$SOURCE/$PROFILE/configuration.properties > configuration.properties +curl https://raw.githubusercontent.com/$SOURCE/$PROFILE/INDICATORS.properties > trading/INDICATORS.properties +curl https://raw.githubusercontent.com/$SOURCE/$PROFILE/PAIRS.properties > trading/PAIRS.properties +curl https://raw.githubusercontent.com/$SOURCE/$PROFILE/DCA.properties > trading/DCA.properties echo $PROFILE loaded. } function RestoreBackup { cd ~/ProfitTrailer -cp application.properties.backup application.properties cp configuration.properties.backup configuration.properties cp trading/PAIRS.properties.backup trading/PAIRS.properties cp trading/INDICATORS.properties.backup trading/INDICATORS.properties cp trading/DCA.properties.backup trading/DCA.properties echo Backups restored } -VALUES=$(curl -s "https://api.github.com/repos/tomohern/PTSettings/branches" | grep '"name":' | sed -e 's/.*:\s\+"\([^"]\+\).*/\1/g' -e 's/master/Default/g' | tr '\n' ' ') +VALUES=$(curl -s "https://api.github.com/repos/$SOURCE/branches" | grep '"name":' | sed -e 's/.*:\s\+"\([^"]\+\).*/\1/g' -e 's/master/Default/g' | tr '\n' ' ') OPTIONS="$VALUES Restore Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then From 2069a8abd07469e9e635ddc1ce26a70592dd5af0 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 08:29:55 -0800 Subject: [PATCH 25/35] Update downloadLatestPT From e07ce322300cf892c5de1408b405149e837a9159 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 08:50:09 -0800 Subject: [PATCH 26/35] Create swapPTjar --- swapPTjar | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 swapPTjar diff --git a/swapPTjar b/swapPTjar new file mode 100644 index 0000000..6295067 --- /dev/null +++ b/swapPTjar @@ -0,0 +1,5 @@ +#!/bin/bash +rm -rf ProfitTrailerBackup +cp -r ProfitTrailer ProfitTrailerBackup +ps -ef | grep "sudo java -jar ProfitTrailer.jar" | awk '{print $2}' | head -1 | xargs sudo kill +cp ~/new/ProfitTrailer/ProfitTrailer.jar ~/ProfitTrailer/ProfitTrailer.jar From 5cf06f6e826aa4e0bdb38781841e4f51d9b2788d Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 08:52:30 -0800 Subject: [PATCH 27/35] Update updatescripts --- updatescripts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/updatescripts b/updatescripts index 1189a31..c318247 100644 --- a/updatescripts +++ b/updatescripts @@ -1,9 +1,14 @@ #!/bin/bash #Install needed scripts # +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/updatescripts > updatescripts +sudo chmod +x updatescripts sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > profittrailer sudo chmod +x profittrailer sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > loadprofile sudo chmod +x loadprofile sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > downloadLatestPT sudo chmod +x downloadLatestPT +sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/swapPTjar > swapPTjar +sudo chmod +x swapPTjar + From 0ac54131036e1f95d2f97be62600a1f6879b353a Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:03:56 -0800 Subject: [PATCH 28/35] Update downloadLatestPT --- downloadLatestPT | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/downloadLatestPT b/downloadLatestPT index f145bae..ec51e24 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -1,7 +1,6 @@ #!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) -cd ~/new rm -rf ~/new/ProfitTrailer/ -wget https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -unzip ProfitTrailer.zip -mv ProfitTrailer.zip ProfitTrailer_$ver.zip +wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip +unzip ProfitTrailer_$ver.zip +#mv ProfitTrailer.zip ProfitTrailer_$ver.zip From f6c5256a34e3f81d634c994730a95a4699844579 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:05:46 -0800 Subject: [PATCH 29/35] Update downloadLatestPT --- downloadLatestPT | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/downloadLatestPT b/downloadLatestPT index ec51e24..ba94244 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -2,5 +2,4 @@ ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) rm -rf ~/new/ProfitTrailer/ wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -unzip ProfitTrailer_$ver.zip -#mv ProfitTrailer.zip ProfitTrailer_$ver.zip +unzip ~/new/ProfitTrailer_$ver.zip From c09404243dc24cc3202f4f5522c987d063d099c3 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:09:49 -0800 Subject: [PATCH 30/35] Update downloadLatestPT --- downloadLatestPT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloadLatestPT b/downloadLatestPT index ba94244..a3619a6 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -1,5 +1,5 @@ #!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) rm -rf ~/new/ProfitTrailer/ -wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip +#wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip unzip ~/new/ProfitTrailer_$ver.zip From 27b857cd93c3733fd15cc97b89f88560f59419da Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:13:03 -0800 Subject: [PATCH 31/35] Update downloadLatestPT --- downloadLatestPT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloadLatestPT b/downloadLatestPT index a3619a6..b4f655d 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -2,4 +2,4 @@ ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) rm -rf ~/new/ProfitTrailer/ #wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -unzip ~/new/ProfitTrailer_$ver.zip +unzip ~/new/ProfitTrailer_$ver.zip -d ~/new/ From 1cb6a8379e61cd8e8588f3efae2621a3468032ef Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:18:16 -0800 Subject: [PATCH 32/35] Update downloadLatestPT --- downloadLatestPT | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/downloadLatestPT b/downloadLatestPT index b4f655d..1e249ee 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -2,4 +2,5 @@ ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) rm -rf ~/new/ProfitTrailer/ #wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip -unzip ~/new/ProfitTrailer_$ver.zip -d ~/new/ +cd ~/new +unzip ~/new/ProfitTrailer_$ver.zip From 4240888617b5aace2ab48c53b98b41fd872e58f4 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:21:27 -0800 Subject: [PATCH 33/35] Update swapPTjar --- swapPTjar | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swapPTjar b/swapPTjar index 6295067..ec920b3 100644 --- a/swapPTjar +++ b/swapPTjar @@ -1,5 +1,5 @@ #!/bin/bash -rm -rf ProfitTrailerBackup -cp -r ProfitTrailer ProfitTrailerBackup +rm -rf ~/ProfitTrailerBackup +cp -r ~/ProfitTrailer ~/ProfitTrailerBackup ps -ef | grep "sudo java -jar ProfitTrailer.jar" | awk '{print $2}' | head -1 | xargs sudo kill cp ~/new/ProfitTrailer/ProfitTrailer.jar ~/ProfitTrailer/ProfitTrailer.jar From 899669d6692e134f7ee4b2380c5cce51593a067f Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 09:30:41 -0800 Subject: [PATCH 34/35] Update downloadLatestPT --- downloadLatestPT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloadLatestPT b/downloadLatestPT index 1e249ee..f31e157 100644 --- a/downloadLatestPT +++ b/downloadLatestPT @@ -1,6 +1,6 @@ #!/bin/bash ver=$(curl -s https://api.github.com/repos/taniman/profit-trailer/releases/latest | grep 'browser_' | cut -d '/' -f8) rm -rf ~/new/ProfitTrailer/ -#wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip +wget -O ~/new/ProfitTrailer_$ver.zip https://github.com/taniman/profit-trailer/releases/download/$ver/ProfitTrailer.zip cd ~/new unzip ~/new/ProfitTrailer_$ver.zip From 1f29e624f71a7c83aa2ce6b541c9af60e2cc6cd0 Mon Sep 17 00:00:00 2001 From: tomohern Date: Mon, 5 Feb 2018 14:42:07 -0800 Subject: [PATCH 35/35] Update setup --- setup | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/setup b/setup index ca948d2..b8b44e1 100644 --- a/setup +++ b/setup @@ -9,34 +9,7 @@ apt install unzip # # Create new user to run PT as # -read -p "Create New User? (If not, will continue as Root)" -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - echo Enter Desired Username: - read uname - adduser $uname - usermod -aG sudo $uname - echo Please execute 'downloadLatestPT' - su - $uname - exit -else -downloadLatestPT -fi -# -#Install needed scripts -# -sudo curl https://raw.githubusercontent.com/tomohern/PTS/scripts/updatescripts > /home/$uname/updatescripts -sudo chmod +x /home/$uname/updatescripts -updatescripts -# -#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/profittrailer > /usr/local/bin/profittrailer -#chmod +x /usr/local/bin/profittrailer -#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/loadprofile > /usr/local/bin/loadprofile -#chmod +x /usr/local/bin/loadprofile -#curl https://raw.githubusercontent.com/tomohern/PTS/scripts/downloadLatestPT > /usr/local/bin/downloadLatestPT -#chmod +x /usr/local/bin/downloadLatestPT - - - - +adduser $uname +usermod -aG sudo $uname +echo Please execute 'downloadLatestPT' +su - $uname