I'm trying to set up something that telnets into a device and saves the output to file. I can get it working on the CLI, but not running it at boot (using crontab)
This works running running on the command line:
$ nc <host> <port> | tee -a ~/log.txt
The challenge is getting this to run on system boot using cron. nc doesn't run by itself as a cron, so I run it in screen -d -m and it stays open.
screen -d -m nc <host> <port> | tee -a ~/log.txt
There is no output to the file though. I've also tried:
screen -d -m nc <host> <port> 2>&1 | tee -a ~/log.txt
There is still nothing being output to file... I've seen some people recommending the -d tag on nc, but -d appears to be a delay setting on CentOS 7 and not "ignore STDIN" like others are saying.