I wrote a script that, after starting the OS, depending on some data, starts or kills a graphics program. The graphic server is also started from this script, but after starting the server, the specified program does not start on the graph, but all inputs and outputs from the / dev / ttyS3 port are performed. Here is the script:

#!/bin/bash startx & sleep 4 stty -F /dev/ttyS3 raw ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo pid=0 control=0 info=0 pid=`ps -e | grep squeakvm | awk '{print $1}'` if (( ${#pid} > 3 )) then kill $pid fi echo "35" > /dev/ttyS3 while true do pid=`ps -e | grep squeakvm | awk '{print $1}'` info=`head -c1 /dev/ttyS3` if [ "$info" == "a" ];then #echo "a" > /dev/ttyS3 if (( ${#pid} > 3 ));then kill $pid echo $pid echo "28" > /dev/ttyS3 sleep 1 echo "35" > /dev/ttyS3 else echo "46" > /dev/ttyS3 sleep 1 echo "17" > /dev/ttyS3 squeakvm /root/squeakvm/default.sb & fi fi if [ "$info" == "b" ];then #echo "b" > /dev/ttyS3 echo "37" > /dev/ttyS3 poweroff exit 0 fi done exit 0 

But if you start the Graphic server separately, and then run the script in the terminal there, then everything works, but I need to automatically start everything to start. The script runs from /etc/rc.local

OS - Linux Debian

Kernel Version 3.2

Graphic Environment - X Window System

  • one
    specify the question, please. naturally, not in the form of "how to make everything work." with such a formulation should apply to any exchange of freelancers. - aleksandr barakin
  • @alexanderbarakin if you run this script in the console, then after the startx command the graphics server starts and works fine with the files (echo "35"> / dev / ttyS3 - this command flashes the LED), but the launch of the "squeakvm" program does not occur. But if you run the script from the terminal emulator, after manually launching Xorg, everything works fine. How to immediately start the second way? - Timeon
  • from man startx : startx x-ΠΊΠ»ΠΈΠ΅Π½Ρ‚ ΠΎΠΏΡ†ΠΈΠΈ-для-x-ΠΊΠ»ΠΈΠ΅Π½Ρ‚Π° . for example: startx xterm ΠΎΠΏΡ†ΠΈΠΈ-для-xterm - aleksandr barakin
  • @alexanderbarakin and more? Can I run the script this way in a terminal emulator? - Timeon
  • for details, see the documentation (mentioned above). yes you can. but since you mentioned the β€œx-terminal emulator”, it means that you have at least one x-server running. and by default, the display number 0 already taken, so you need to transfer a new number to a new instance, for example, 1 : startx x-ΠΊΠ»ΠΈΠ΅Π½Ρ‚ ΠΎΠΏΡ†ΠΈΠΈ-для-x-ΠΊΠ»ΠΈΠ΅Π½Ρ‚Π° -- :1 - aleksandr barakin

0