Post by cciecanuck on Jan 13, 2021 23:00:55 GMT -8
Hi Everyone,
I have created a small bash control script for starting the Smart Garden System python applications. The script requires that TMUX be installed as well. It will launch all three apps into a single pane. This creates a useful console for output should you need it. Attached are the script and screenshot of the tmux session. You can add this to your crontab to startup on reboot or to check every X minutes to see if the service is running. Copy the script into the /home/pi/SDL_Pi_SmartGardenSystem2 and type "chmod +x sgsctl". Once you have done, the control script can be run as seen below.
The script works with the following basic functions:
1) sgsctl start - This will start all three Smart Garden Systems (Config, SGS2, and Dash) as well as a MQTT client to watch the control traffic for potential troubleshooting into a tmux window (this will stay alive even if you disconnect). The start function checks to make sure that all the required services are not currently running. The script will also make sure that the MQTT broker us running as well.
2) sgsctl stop - This will kill the tmux session, thus stopping all the services.
3) sgsctl attach - This will attach you to the tmux session. This will allow you to see all the output from the smart garden system. To detach the session use the control +b then d keys.
4) sgsctl - status - This will display the current status of the SGS scripts.
5) sgsctl restart - This will kill the running tmux session and relaunch the Smart Garden System scripts.
6) sgsctl cron - This option is meant to be used for adding to a linux system crontab for automagically check to ensure the services are running.
I have created a small bash control script for starting the Smart Garden System python applications. The script requires that TMUX be installed as well. It will launch all three apps into a single pane. This creates a useful console for output should you need it. Attached are the script and screenshot of the tmux session. You can add this to your crontab to startup on reboot or to check every X minutes to see if the service is running. Copy the script into the /home/pi/SDL_Pi_SmartGardenSystem2 and type "chmod +x sgsctl". Once you have done, the control script can be run as seen below.
The script works with the following basic functions:
1) sgsctl start - This will start all three Smart Garden Systems (Config, SGS2, and Dash) as well as a MQTT client to watch the control traffic for potential troubleshooting into a tmux window (this will stay alive even if you disconnect). The start function checks to make sure that all the required services are not currently running. The script will also make sure that the MQTT broker us running as well.
2) sgsctl stop - This will kill the tmux session, thus stopping all the services.
3) sgsctl attach - This will attach you to the tmux session. This will allow you to see all the output from the smart garden system. To detach the session use the control +b then d keys.
4) sgsctl - status - This will display the current status of the SGS scripts.
5) sgsctl restart - This will kill the running tmux session and relaunch the Smart Garden System scripts.
6) sgsctl cron - This option is meant to be used for adding to a linux system crontab for automagically check to ensure the services are running.