attach to tty running a process

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a systemd service file that runs a java program in another tty



[Unit]
Description=java program
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/java -cp "/home/user/someclass.jar"
Restart=always
RestartSec=10
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
TTYPath=/dev/tty10
TTYVTDisallocate=yes
TTYReset=yes
TTYVHangup=yes

[Install]
WantedBy=multi-user.target


The program waits for input in the tty, I can change to that tty by using Ctrl+Alt+F10 or using chvt 10 and I'm able to interact with the program.



Now I want to send input and get output from that tty without changing my current tty.
I tried using screen and all I get is a blank screen and. I tried using script which succeeded if I run bash in that tty but fails If i run a java program







share|improve this question
























    up vote
    0
    down vote

    favorite












    I have a systemd service file that runs a java program in another tty



    [Unit]
    Description=java program
    After=network-online.target

    [Service]
    Type=simple
    ExecStart=/usr/bin/java -cp "/home/user/someclass.jar"
    Restart=always
    RestartSec=10
    StandardInput=tty-force
    StandardOutput=inherit
    StandardError=inherit
    TTYPath=/dev/tty10
    TTYVTDisallocate=yes
    TTYReset=yes
    TTYVHangup=yes

    [Install]
    WantedBy=multi-user.target


    The program waits for input in the tty, I can change to that tty by using Ctrl+Alt+F10 or using chvt 10 and I'm able to interact with the program.



    Now I want to send input and get output from that tty without changing my current tty.
    I tried using screen and all I get is a blank screen and. I tried using script which succeeded if I run bash in that tty but fails If i run a java program







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a systemd service file that runs a java program in another tty



      [Unit]
      Description=java program
      After=network-online.target

      [Service]
      Type=simple
      ExecStart=/usr/bin/java -cp "/home/user/someclass.jar"
      Restart=always
      RestartSec=10
      StandardInput=tty-force
      StandardOutput=inherit
      StandardError=inherit
      TTYPath=/dev/tty10
      TTYVTDisallocate=yes
      TTYReset=yes
      TTYVHangup=yes

      [Install]
      WantedBy=multi-user.target


      The program waits for input in the tty, I can change to that tty by using Ctrl+Alt+F10 or using chvt 10 and I'm able to interact with the program.



      Now I want to send input and get output from that tty without changing my current tty.
      I tried using screen and all I get is a blank screen and. I tried using script which succeeded if I run bash in that tty but fails If i run a java program







      share|improve this question












      I have a systemd service file that runs a java program in another tty



      [Unit]
      Description=java program
      After=network-online.target

      [Service]
      Type=simple
      ExecStart=/usr/bin/java -cp "/home/user/someclass.jar"
      Restart=always
      RestartSec=10
      StandardInput=tty-force
      StandardOutput=inherit
      StandardError=inherit
      TTYPath=/dev/tty10
      TTYVTDisallocate=yes
      TTYReset=yes
      TTYVHangup=yes

      [Install]
      WantedBy=multi-user.target


      The program waits for input in the tty, I can change to that tty by using Ctrl+Alt+F10 or using chvt 10 and I'm able to interact with the program.



      Now I want to send input and get output from that tty without changing my current tty.
      I tried using screen and all I get is a blank screen and. I tried using script which succeeded if I run bash in that tty but fails If i run a java program









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 6 at 11:18









      MOHAMMAD RASIM

      586




      586




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The PTY feature of socat may be your best bet for interfacing terminal-heavy apps programmatically w/o any extra functionality. See the examples in the man page.



          Also, dtach provides screen-like (multi-way) reattachment semantics for easy access from a terminal emulator.






          share|improve this answer




















          • Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
            – MOHAMMAD RASIM
            Mar 6 at 12:19










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428474%2fattach-to-tty-running-a-process%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          The PTY feature of socat may be your best bet for interfacing terminal-heavy apps programmatically w/o any extra functionality. See the examples in the man page.



          Also, dtach provides screen-like (multi-way) reattachment semantics for easy access from a terminal emulator.






          share|improve this answer




















          • Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
            – MOHAMMAD RASIM
            Mar 6 at 12:19














          up vote
          0
          down vote













          The PTY feature of socat may be your best bet for interfacing terminal-heavy apps programmatically w/o any extra functionality. See the examples in the man page.



          Also, dtach provides screen-like (multi-way) reattachment semantics for easy access from a terminal emulator.






          share|improve this answer




















          • Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
            – MOHAMMAD RASIM
            Mar 6 at 12:19












          up vote
          0
          down vote










          up vote
          0
          down vote









          The PTY feature of socat may be your best bet for interfacing terminal-heavy apps programmatically w/o any extra functionality. See the examples in the man page.



          Also, dtach provides screen-like (multi-way) reattachment semantics for easy access from a terminal emulator.






          share|improve this answer












          The PTY feature of socat may be your best bet for interfacing terminal-heavy apps programmatically w/o any extra functionality. See the examples in the man page.



          Also, dtach provides screen-like (multi-way) reattachment semantics for easy access from a terminal emulator.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 6 at 11:30









          L29Ah

          451112




          451112











          • Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
            – MOHAMMAD RASIM
            Mar 6 at 12:19
















          • Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
            – MOHAMMAD RASIM
            Mar 6 at 12:19















          Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
          – MOHAMMAD RASIM
          Mar 6 at 12:19




          Can you provide an example of socat to run on /dev/tty10? Also looking at the man page of dtach I see no mention of dtach working with ttys, only sockets.
          – MOHAMMAD RASIM
          Mar 6 at 12:19












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428474%2fattach-to-tty-running-a-process%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay