Hi,
I have a .sh script that connect to a network box and received some info the I query. I want to use the “reply” from the network box to set a state of a switch.
Anybody knows if that is possible? If yes, how?
Thanks
Regards
Claus
Hi,
I have a .sh script that connect to a network box and received some info the I query. I want to use the “reply” from the network box to set a state of a switch.
Anybody knows if that is possible? If yes, how?
Thanks
Regards
Claus
At least 3 ways I know of
Hi,
Thanks for the reply. I’m a linux noob, so if you can help with some examples
I have two switched. “Light 1” and “Light 2”
I have a sh file with this content:
{ echo “>>Login xxxxx<<”;sleep 1;echo “>>Get 40864<<”;sleep 1;echo “>>Get 40849<<”;sleep 1;echo “>>Logout<<”; } | nc xxx.xxx.xxx.xxx 88888
The “reply” from the sh script is this when I parse it to a txt file:
Logout Ok<<
Login Ok<<
Get 100<<
Get 0<<
“Get 100” means the switch in line 3 (Light 1) is “On” and “Get 0” means switch in line 4 (Light 2) is “Off”
I would like to update the state of switch “light 1” and “light 2” bases on the outcome from the script. So “Light 1” will be set to “On” and “Light 2” will be set to off.
Is this possible and can anyone prove an example?
Thanks
Regards
Claus