I'm trying to write a monitoring script. It should connect to some port on my server, read the output, and if the output is the expected value, print 1 otherwise 0.
I'm working on a solution involving cat < /dev/tcp/hostname/port
, but the solution eludes me. Maybe something involving expect? I'd prefer a bash script solution. Help appreciated!