title: Linux Shell, How to send a command over Serial port and return?
body: <p>I am looking to send a 'reboot' command over the serial port to the PDU. What I have to do in the interactive mode is this:</p>
  
  <pre><code>#screen /dev/ttyS1
  &gt;reboot
  &gt;[Detach Screen]
  #
  </code></pre>
  
  <p>If I want to automate this task in a script, I should be able to reboot the PDU with a single command from shell like this:</p>
  
  <pre><code>#echo "reboot" &gt;/dev/ttyS1
  </code></pre>
  
  <p>However, it does not work ! I don't know why.... Would you be able to help me ?</p>
  
  <p>The PDU manual request baud rate of 9600 which is not a default baud rate. I have tried following command to set the baud rate but still no lock:</p>
  
  <pre><code>stty -F /dev/ttyS1 speed 9600 cs8 -cstopb -parenb 
  </code></pre>
  
  <p>These outputs does not change with or without screen:</p>
  
  <pre><code> # stty -a -F /dev/ttyS1
      speed 9600 baud; rows 0; columns 0; line = 0;
      intr = ^C; quit = ^\; erase = ^?; kill = ^H; eof = ^D; eol = &lt;undef&gt;;
      eol2 = &lt;undef&gt;; swtch = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z;     rprnt = ^R;
      werase = ^W; lnext = ^V; flush = ^O; min = 100; time = 2;
      -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
      -ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon    -ixoff
      -iuclc -ixany -imaxbel -iutf8
      -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
      -isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
      echoctl echoke
  </code></pre>