Skip to content

Commit

Permalink
Uninstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
christianTF committed Jan 15, 2020
1 parent 2e78330 commit 7f53512
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions uninstall/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

. $LBHOMEDIR/libs/bashlib/notify.sh

echo "<INFO> Getting last used broker credentials"
USER="$(jq '.Credentials.brokeruser' REPLACELBPCONFIGDIR/cred.json)"
PASS="$(jq '.Credentials.brokerpass' REPLACELBPCONFIGDIR/cred.json)"

echo "<INFO> Sending notification about last credentials"
notify plugininstall uninstall "MQTT Gateway uninstalled. Your last broker credentials: USER: $USER PASS: $PASS. Copy this NOW, if you need to recreate broker settings with same credentials!"

echo "<INFO> Stopping MQTT Gateway service"
pkill mqttgateway.pl

echo "<INFO> Stopping Mosquitto"
systemctl stop mosquitto

if [ -e /etc/mosquitto/conf.d/mqttgateway.conf ] ; then
echo "<INFO> Removing Mosquitto config symlink from plugin (uninstall)"
unlink /etc/mosquitto/conf.d/mqttgateway.conf
fi

# Uninstall Mosquitto
echo "<INFO> Uninstalling Mosquitto"
apt-get -y purge mosquitto

exit 0

0 comments on commit 7f53512

Please sign in to comment.