From 0ba2258d5cb19392955493d6625c3a8bff8b6d17 Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Wed, 12 Sep 2018 13:42:00 +0000 Subject: [PATCH] fix bugs --- bin/tped.sh | 16 +++++++++++++++- iso/installer/install.sh | 2 +- update.sh | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/tped.sh b/bin/tped.sh index 184a5571..a654ea73 100755 --- a/bin/tped.sh +++ b/bin/tped.sh @@ -5,6 +5,17 @@ myBACKTITLE="T-Pot Edition Selection Tool" myYMLS=$(cd /opt/tpot/etc/compose/ && ls -1 *.yml) myLINK="/opt/tpot/etc/tpot.yml" +# Let's load docker images in parallel +function fuPULLIMAGES { +local myTPOTCOMPOSE="/opt/tpot/etc/tpot.yml" +for name in $(cat $myTPOTCOMPOSE | grep -v '#' | grep image | cut -d'"' -f2 | uniq) + do + docker pull $name & + done +wait +echo +} + # setup menu for i in $myYMLS; do @@ -20,10 +31,13 @@ dialog --backtitle "$myBACKTITLE" --title "[ Activate now? ]" --yesno "\n$myEDIT myOK=$? if [ "$myOK" == "0" ]; then - echo "OK - Activating" + echo "OK - Activating and downloading latest images." systemctl stop tpot + docker stop $(docker ps -aq) + docker rm $(docker ps -aq) rm -f $myLINK ln -s /opt/tpot/etc/compose/$myEDITION $myLINK + fuPULLIMAGES systemctl start tpot echo "Done. Use \"dps.sh\" for monitoring" else diff --git a/iso/installer/install.sh b/iso/installer/install.sh index bd0f3aca..683049fd 100755 --- a/iso/installer/install.sh +++ b/iso/installer/install.sh @@ -679,7 +679,7 @@ myCRONJOBS=" */1 * * * * root mv --backup=numbered /data/dionaea/roots/ftp/* /data/dionaea/binaries/ # Daily reboot -27 3 * * * root reboot +27 3 * * * root systemctl stop tpot && docker stop $(docker ps -aq) && docker rm $(docker ps -aq) && reboot # Check for updated packages every sunday, upgrade and reboot 27 16 * * 0 root apt-get autoclean -y && apt-get autoremove -y && apt-get update -y && apt-get upgrade -y && sleep 10 && reboot diff --git a/update.sh b/update.sh index 9416ea81..fa698181 100755 --- a/update.sh +++ b/update.sh @@ -112,6 +112,9 @@ if [ $? -ne 0 ]; exit 1 else echo "[ $myGREEN"OK"$myWHITE ]" + echo "###### $myBLUE Now cleaning up containers.$myWHITE " + docker stop $(docker ps -aq) + docker rm $(docker ps -aq) fi echo }