Skip to content

Commit

Permalink
Improve uninstall scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoJacobs committed Jul 2, 2020
1 parent daea732 commit 9c6daad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions bbb-libreoffice/assets/libreoffice_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ _kill() {
fi;
}

trap _kill INT
trap _kill TERM
trap _kill SIGINT


if (($INSTANCE_NUMBER >= 1 && $INSTANCE_NUMBER <= 10)); then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

_kill

docker run --name bbb-libreoffice-${INSTANCE_NUMBER} -p 82${INSTANCE_NUMBER}:8000 -v/var/tmp/soffice${INSTANCE_NUMBER}:/var/tmp/soffice${INSTANCE_NUMBER} --rm bbb-libreoffice
docker run --name bbb-libreoffice-${INSTANCE_NUMBER} -p 82${INSTANCE_NUMBER}:8000 -v/var/tmp/soffice${INSTANCE_NUMBER}:/var/tmp/soffice${INSTANCE_NUMBER} --rm bbb-libreoffice &

wait $!
else
echo ;
echo "Invalid or missing parameter INSTANCE_NUMBER"
Expand Down
5 changes: 3 additions & 2 deletions bbb-libreoffice/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ if [ "$FOLDER_CHECK" = "0" ]; then

for i in `seq 1 4` ; do
cat assets/bbb-libreoffice.service | sed 's/INSTANCE_NUMBER/0'${i}'/g' > /lib/systemd/system/bbb-libreoffice-0${i}.service
systemctl daemon-reload
systemctl enable bbb-libreoffice-0${i}
systemctl start bbb-libreoffice-0${i}
done

systemctl daemon-reload

else
echo "Install folder already exists"
fi;
Expand Down
3 changes: 3 additions & 0 deletions bbb-libreoffice/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fi;

IMAGE_CHECK=`docker image inspect bbb-libreoffice 2>&1 > /dev/null && echo 1 || echo 0`
if [ "$IMAGE_CHECK" = "1" ]; then
echo "Stopping services"
systemctl --no-pager --no-legend --value --state=running | grep bbb-libreoffice | awk -F '.service' '{print $1}' | xargs -n 1 systemctl stop

echo "Removing image"
docker image rm bbb-libreoffice
fi
Expand Down

0 comments on commit 9c6daad

Please sign in to comment.