item3.sh 819 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. #Item3 MQTT
  3. # install&setting mqtt server
  4. sudo -H pip3 install paho-mqtt
  5. sudo apt-get install mosquitto -y
  6. sudo systemctl start mosquitto
  7. sudo ufw allow 1883/tcp
  8. sudo ufw allow 8080/tcp
  9. # get mqtt server file mosquitto.conf
  10. # get mqtt server file passwd.conf
  11. cd /home/使用者;pwd;sudo git clone -b mosquitto --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /home/使用者/mosquitto/;sudo git clone -b passwd --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /home/使用者/passwd/;sudo mv /home/使用者/mosquitto/mosquitto.conf /etc/mosquitto/;sudo mv /home/使用者/passwd/passwd /etc/mosquitto/;sudo rm -rf /home/使用者/mosquitto/;sudo rm -rf /home/使用者/passwd/;pwd
  12. sudo systemctl restart mosquitto
  13. echo "mqtt server file done"