Changing a process' output to ssh terminal





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















I have a simple python script:



import time
counter = 0
while True:
print counter
counter = counter + 1
time.sleep(10)


Let's say this is running on my linuxbox inside LAN and is printing the output to the terminal that linuxbox. If I am to ssh into that server, I want to see the status of counter variable. In other words, I want to change the I/O of the program from default terminal to ssh terminal.



So far I've tried to put the process in background by using fg without any luck.



Here's a snapshot (from ssh terminal)



jarwin@ubuntu:~$ ps -a
PID TTY TIME CMD
30412 pts/1 00:00:02 python
30591 pts/10 00:00:00 ps
jarwin@ubuntu:~$ fg %30412
-bash: fg: %30412: no such job
jarwin@ubuntu:~$ top | grep gnome
27337 azazel 20 0 625656 35804 24676 S 0.3 1.4 1:03.01 gnome-terminal-
jarwin@ubuntu:~$ fg %27337
-bash: fg: %27337: no such job


Is it possible to do that? And in case python does not allow that, is it possible to change to ssh terminal for a ping command?



PS: I am using JuiceSSH on Android as my ssh-client










share|improve this question




















  • 1





    Possible duplicate of Can one access an open terminal on the computer via SSH?

    – muru
    Oct 26 '17 at 2:36


















4















I have a simple python script:



import time
counter = 0
while True:
print counter
counter = counter + 1
time.sleep(10)


Let's say this is running on my linuxbox inside LAN and is printing the output to the terminal that linuxbox. If I am to ssh into that server, I want to see the status of counter variable. In other words, I want to change the I/O of the program from default terminal to ssh terminal.



So far I've tried to put the process in background by using fg without any luck.



Here's a snapshot (from ssh terminal)



jarwin@ubuntu:~$ ps -a
PID TTY TIME CMD
30412 pts/1 00:00:02 python
30591 pts/10 00:00:00 ps
jarwin@ubuntu:~$ fg %30412
-bash: fg: %30412: no such job
jarwin@ubuntu:~$ top | grep gnome
27337 azazel 20 0 625656 35804 24676 S 0.3 1.4 1:03.01 gnome-terminal-
jarwin@ubuntu:~$ fg %27337
-bash: fg: %27337: no such job


Is it possible to do that? And in case python does not allow that, is it possible to change to ssh terminal for a ping command?



PS: I am using JuiceSSH on Android as my ssh-client










share|improve this question




















  • 1





    Possible duplicate of Can one access an open terminal on the computer via SSH?

    – muru
    Oct 26 '17 at 2:36














4












4








4








I have a simple python script:



import time
counter = 0
while True:
print counter
counter = counter + 1
time.sleep(10)


Let's say this is running on my linuxbox inside LAN and is printing the output to the terminal that linuxbox. If I am to ssh into that server, I want to see the status of counter variable. In other words, I want to change the I/O of the program from default terminal to ssh terminal.



So far I've tried to put the process in background by using fg without any luck.



Here's a snapshot (from ssh terminal)



jarwin@ubuntu:~$ ps -a
PID TTY TIME CMD
30412 pts/1 00:00:02 python
30591 pts/10 00:00:00 ps
jarwin@ubuntu:~$ fg %30412
-bash: fg: %30412: no such job
jarwin@ubuntu:~$ top | grep gnome
27337 azazel 20 0 625656 35804 24676 S 0.3 1.4 1:03.01 gnome-terminal-
jarwin@ubuntu:~$ fg %27337
-bash: fg: %27337: no such job


Is it possible to do that? And in case python does not allow that, is it possible to change to ssh terminal for a ping command?



PS: I am using JuiceSSH on Android as my ssh-client










share|improve this question
















I have a simple python script:



import time
counter = 0
while True:
print counter
counter = counter + 1
time.sleep(10)


Let's say this is running on my linuxbox inside LAN and is printing the output to the terminal that linuxbox. If I am to ssh into that server, I want to see the status of counter variable. In other words, I want to change the I/O of the program from default terminal to ssh terminal.



So far I've tried to put the process in background by using fg without any luck.



Here's a snapshot (from ssh terminal)



jarwin@ubuntu:~$ ps -a
PID TTY TIME CMD
30412 pts/1 00:00:02 python
30591 pts/10 00:00:00 ps
jarwin@ubuntu:~$ fg %30412
-bash: fg: %30412: no such job
jarwin@ubuntu:~$ top | grep gnome
27337 azazel 20 0 625656 35804 24676 S 0.3 1.4 1:03.01 gnome-terminal-
jarwin@ubuntu:~$ fg %27337
-bash: fg: %27337: no such job


Is it possible to do that? And in case python does not allow that, is it possible to change to ssh terminal for a ping command?



PS: I am using JuiceSSH on Android as my ssh-client







ssh gnome-terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 33 mins ago









Pang

14326




14326










asked Nov 19 '15 at 11:40









JarwinJarwin

190118




190118








  • 1





    Possible duplicate of Can one access an open terminal on the computer via SSH?

    – muru
    Oct 26 '17 at 2:36














  • 1





    Possible duplicate of Can one access an open terminal on the computer via SSH?

    – muru
    Oct 26 '17 at 2:36








1




1





Possible duplicate of Can one access an open terminal on the computer via SSH?

– muru
Oct 26 '17 at 2:36





Possible duplicate of Can one access an open terminal on the computer via SSH?

– muru
Oct 26 '17 at 2:36










1 Answer
1






active

oldest

votes


















3














You can try your luck with tmux or screen, which allows you to to connect to existing terminal sessions.



The other workaround I would consider is to use some temporary file, where you would write the output (if the output is kind of log) and then follow the new lines in the file using tail -f.






share|improve this answer


























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f699984%2fchanging-a-process-output-to-ssh-terminal%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    You can try your luck with tmux or screen, which allows you to to connect to existing terminal sessions.



    The other workaround I would consider is to use some temporary file, where you would write the output (if the output is kind of log) and then follow the new lines in the file using tail -f.






    share|improve this answer






























      3














      You can try your luck with tmux or screen, which allows you to to connect to existing terminal sessions.



      The other workaround I would consider is to use some temporary file, where you would write the output (if the output is kind of log) and then follow the new lines in the file using tail -f.






      share|improve this answer




























        3












        3








        3







        You can try your luck with tmux or screen, which allows you to to connect to existing terminal sessions.



        The other workaround I would consider is to use some temporary file, where you would write the output (if the output is kind of log) and then follow the new lines in the file using tail -f.






        share|improve this answer















        You can try your luck with tmux or screen, which allows you to to connect to existing terminal sessions.



        The other workaround I would consider is to use some temporary file, where you would write the output (if the output is kind of log) and then follow the new lines in the file using tail -f.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 17 '15 at 19:47









        David Foerster

        28.7k1367113




        28.7k1367113










        answered Nov 19 '15 at 13:11









        JakujeJakuje

        5,35471831




        5,35471831






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f699984%2fchanging-a-process-output-to-ssh-terminal%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            GameSpot

            日野市

            Tu-95轟炸機