Score:1

Ubuntu 20.04 - Running 3 commands on terminal after startup (any stay open )

cn flag

After reboot I need 3 terminals open, running a MQTT subscriptions.

For that I divide to process into 2 segments: 1) a .sh file, running those subscriptions, and 2) executing after reboot.

Part 1 -mqtts.sh file

#! /bin/bash

gnome-terminal --tab -- mosquitto_sub -u "guy" -P "1234" -h "192.168.3.200" -t "myHome/Messages"
gnome-terminal --tab -- mosquitto_sub -u "guy" -P "1234" -h "192.168.3.200" -t "myHome/log"
gnome-terminal --tab -- mosquitto_sub -u "guy" -P "1234" -h "192.168.3.200" -t "myHome/debug"
gnome-terminal -- mosquitto_pub -u "guy" -P "1234" -h "192.168.3.200" -t "myHome/All" -m "status"

When I execute this file, 3 new tabs gets opened displaying subscriptions as needed.

Question 1: How to edit each tab's title ?

Part 2 - Running at startup

I tried several options:

  1. Adding a cron job using sudo crontab -e, adding @reboot /home/guy/Documents/mqtts.sh`.FAILED

  2. Adding /etc/rc.local a line /home/guy/Documents/mqtts.sh || exit 1.FAILED

Question 2: What is wrong with ways 1,2 that failed?

Guy

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.