This is my script to power on a ILO2 HP server.Works fine(the server power on) but after the power on the ilo console remain open and I can exit from script only using ctrl+cby hand, so the script is not full non-interactive, how to passa correct ^D to exit from console?
#!/usr/bin/expect -fset force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originallyif {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg }}set timeout -1set send_slow {1 .1}spawn cshmatch_max 100000expect -exact "% "sleep .1send -s -- "ssh hpilo2\r"expect -exact "ssh hpilo2\r\rThis is a private system. It is to be used solely by authorized users and may be monitored for all lawful purposes. By accessing this system, you are consenting to such monitoring.\r\rmyuser@hpilo2's password: "sleep .1send -s -- "mypass\r"expect -exact "\rUser:myuser logged-in to hpilo2.(******* / *********)\r\riLO Advanced **** at Feb 28 2041\rServer Name: \rServer Power: Off\r\r</>hpiLO-> "sleep .1send -s -- "power on\r"expect -exact "\r\rstatus=0\rstatus_tag=COMMAND COMPLETED\rSat Dec 6 12:38:17 2031\r\r\rServer powering on .......\r\r\r\r</>hpiLO-> "sleep .1send -- "^D"expect eof