-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e78330
commit 7f53512
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |