I am new to linux scripting. Please help. I searched on below a lot but was not able to find appropriate answer :
I am trying to make a script which I will later schedule as cronjob, so that it keeps running on backend and stores results in a file say test.txt
Main points of script are below :
it connects to a host through ssh and then runs a few commands on that host and saves the results in a file.The script is connecting to host successfully but not running commands automatically on host. Script is as below :
#!/usr/bin/expect -f spawn ssh aspen expect "password: " send "PASSWORD\r" expect "$ " send "/bin/sh /home/target/Script.sh >>test.txt" expect "$ " send "exit\r"
But when I run this script it doesn't save complete output on test.txt Second thing is I want this output file on my own system not on host . Any help will be appreciable.