diff --git a/downloadLatestPT b/downloadLatestPT new file mode 100644 index 0000000..f31e157 --- /dev/null +++ b/downloadLatestPT @@ -0,0 +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 +cd ~/new +unzip ~/new/ProfitTrailer_$ver.zip diff --git a/loadprofile b/loadprofile new file mode 100644 index 0000000..4448268 --- /dev/null +++ b/loadprofile @@ -0,0 +1,47 @@ +#!/bin/bash + +SOURCE=tomohern/PTSettings + +function LoadProfile { +cd ~/ProfitTrailer +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 +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 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/$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 + echo done + 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 + fi +done + 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 +! 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 diff --git a/setup b/setup new file mode 100644 index 0000000..b8b44e1 --- /dev/null +++ b/setup @@ -0,0 +1,15 @@ +#!/bin/bash +# +#Update and install needed software +# +apt update +unattended-upgrades -d +apt install openjdk-8-jre-headless +apt install unzip +# +# Create new user to run PT as +# +adduser $uname +usermod -aG sudo $uname +echo Please execute 'downloadLatestPT' +su - $uname diff --git a/swapPTjar b/swapPTjar new file mode 100644 index 0000000..ec920b3 --- /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 diff --git a/updatescripts b/updatescripts new file mode 100644 index 0000000..c318247 --- /dev/null +++ b/updatescripts @@ -0,0 +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 +